ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: Superslayer on August 16, 2010, 09:50:35 PM

Title: Back to some basics
Post by: Superslayer on August 16, 2010, 09:50:35 PM
Believe it or not, I've never written a fully automated mining script.  I've only used others' and gave feedback about them, usually a compliment, thank you and possibly thoughts/suggestions.

Below is a snippet of what my question concerns, so here it goes.

Is it possible to dig the tile my char is standing on?  I've hit a few roadblocks with using the tile command and setting ltargetx/y, ltargettile.  I've been searching here and there for the past several hours and haven't come to an answer.

Code: [Select]
Sub MainLoop
  GoSub TM_RailInit

  set %dest 2
  While #clilogged = 1
  {
    ;pause
    set #lobjectid %CurrentShovel
    event macro 17 0
    set #LTargetKind 2
    click %xcoord %ycoord f ;d ;       #charposx #charposY  ;click
    wait 1s
    GoSub TM_AdvJournalScan mine VALID_ADVANCE You_destroyed full
    if #result = #true ; shovel broke or backpack full
      GoSub CheckResources
    if #weight > ( #maxweight - 5 )
      GoSub Smelt
    GoSub TM_AdvJournalScan mine VALID_ADVANCE no_metal can't_mine cannot_see
    if #result = #true
    {
      call %railsubs TM_DetermineCurrentWaypointIndex
      set #result #result + 1
      Call %railsubs TM_RunRail Private_Cave #result %dest FW
      wait 1s
      set %dest #result + 1
      if #result = 113
      {
        set %dest 2
        Call %railsubs TM_RunRail Private_Cave Present %dest FW
      }
    }
    GoSub TM_AdvJournalSync mine 100
  }
  GoSub Mount on
Return
Title: Re: Back to some basics
Post by: Outlaw Josey Wales on August 16, 2010, 10:07:03 PM
i want even protend to know anything about scripting but i will say this u have to mine at least one square in front of you not abel to mine under foot only exception is t hunting but it want let u dig it up when your standing on it so u have to move square
Title: Re: Back to some basics
Post by: Superslayer on August 16, 2010, 10:35:22 PM
Really? that's absurd. I can manually use the shovel, and target exactly between my feet. EUO is dumb if that can't be duplicated...*not directed at you Outlaw, just the principle.  It's probably something on my end if I can do it in game.
Title: Re: Back to some basics
Post by: Khameleon on August 17, 2010, 12:47:59 AM
doesn't really matter where you dig SS, as long as you hit one of the tiles in the 8x8 resource grid.. if your lucky you can stand in the middle of a resource grid, and get all 4 Full Digs.. thats uh.. what 32 swings in trammel.
Title: Re: Back to some basics
Post by: Outlaw Josey Wales on August 17, 2010, 12:58:31 AM
Really? that's absurd. I can manually use the shovel, and target exactly between my feet. EUO is dumb if that can't be duplicated...*not directed at you Outlaw, just the principle.  It's probably something on my end if I can do it in game.
None taken was  just offering input if can help in any other way just hit me up
Title: Re: Back to some basics
Post by: 12TimesOver on August 17, 2010, 02:58:39 AM
Yes, you can mine the tile you're standing on with EUO.

Why doesn't the code you have above work? I mean, what happens? Where are you trying to mine?

X
Title: Re: Back to some basics
Post by: Superslayer on August 17, 2010, 02:01:43 PM
I'm in a cave, and the message I get is 'you cannot see that'.  The click x & y coord's are as follows:

Code: [Select]
set %Xcoord ( #clixres / 2 )
set %Ycoord ( #cliyres / 2 ) + 75

Title: Re: Back to some basics
Post by: 12TimesOver on August 17, 2010, 03:03:10 PM
I'm in a cave, and the message I get is 'you cannot see that'.  The click x & y coord's are as follows:

Code: [Select]
set %Xcoord ( #clixres / 2 )
set %Ycoord ( #cliyres / 2 ) + 75
Check your #tilecnt detail? If you do a tile get on the tile you are standing on you will find that it has a number of unique "layers", you are probably trying to mine the wrong "layer". What I do is cycle with a For loop like "for %c 1 #tilecnt" then get the z value of that tile and set your dig point.

For fun, try this snippet:

Code: [Select]
set %dx #charposx
set %dy #charposy

tile init
tile cnt %dx %dy
Display The value of TileCnt is #tilecnt
for %c 1 #tilecnt
   {
   tile get %dx %dy %c
   display Tyletype is #tiletype , #spc , TileZ is #tilez , #spc , Charposz is #charposz , #spc , Tilename is #tilename
   }

halt

This should give you the detail for each "layer" of the tile you're standing on.

X
Title: Re: Back to some basics
Post by: Superslayer on August 17, 2010, 03:17:20 PM
I never did a whole lot with tile, so my results of running that bit is 0...for everything.  The tilename is "blank", z coord's is 0, tiletype is 0 and tilecnt is 0.  Is that the issue? I'm 'sorta' on a zero tile level and therefore can't target a null value? That would make sense if that's the case. I'm in tram btw in a cave.
Title: Re: Back to some basics
Post by: 12TimesOver on August 17, 2010, 03:54:46 PM
hmmm, sounds more like my code is suspect or you're having other issues such as the known tile issue that requires a reg fix for example? It should come back with info including the tile name somehting like "Cave_Floor" for example.
Title: Re: Back to some basics
Post by: Superslayer on August 17, 2010, 04:13:35 PM
I did just now place the registry fix and while it did resolve a razor error I've been experiencing for a while (nothing important), my results are still the same..all zero's and tilename is a blank value.  This is annoying that I can rail script the entire UO world, but can't dig at my feet and get the journal to work correctly..heh,..I'll live.

I suspect it's my location,..it's not exactly a known place or one anyone can get to.
Title: Re: Back to some basics
Post by: 12TimesOver on August 17, 2010, 05:05:54 PM
I did just now place the registry fix and while it did resolve a razor error I've been experiencing for a while (nothing important), my results are still the same..all zero's and tilename is a blank value.  This is annoying that I can rail script the entire UO world, but can't dig at my feet and get the journal to work correctly..heh,..I'll live.

I suspect it's my location,..it's not exactly a known place or one anyone can get to.
Does the snippet I gave you give you accurate results elsewhere? I'm assuming I know the place you're talking about ;)

x
Title: Re: Back to some basics
Post by: Superslayer on August 18, 2010, 04:43:42 AM
So I tried the tile snippet you posted in a different location and it works just fine in other caves. I get 2 tile counts, one rock, and the other cave floor. So I'm sure now that the location I'm digging in is just funky as it was never designed to be used as such, and yes, I believe you do know where I'm talking about. :-X ;)
Title: Re: Back to some basics
Post by: 12TimesOver on August 18, 2010, 04:46:25 AM
Interesting. Well I have found that some locations have a different ltargetkind value but I would expect that you would get no message at all if that were the issue. Since you're getting a "can't see that" error I'm pretty confident you need to somehow adjust your z-axis.

X
Title: Re: Back to some basics
Post by: Superslayer on August 18, 2010, 05:00:00 AM
My character z-axis is 0. Should I target -1 or +1? I'll have to come back to this later today. I'm about to hit the sack for the night (I work 3rd shift, daytime is my nighttime).

Here's what I have that is working, but it targets 1 tile directly down from where my character stands.

Code: [Select]
set %Xcoord ( #clixres / 2 )
set %Ycoord ( #cliyres / 2 ) + 75

...

GoSub TM_AdvJournalSync shovel
set #lobjectid %CurrentShovel
set #LTargetKind 2
event macro 17 0
click %xcoord %ycoord f
wait 2
click %xcoord %ycoord f
wait 20
GoSub TM_AdvJournalScan shovel VALID You_destroyed
if #result = #true ; shovel broke
GoSub CheckResources
menu set MyWt My Weight: #weight
GoSub TM_AdvJournalSync shovel
Title: Re: Back to some basics
Post by: Superslayer on August 21, 2010, 01:47:36 PM
For whatever reason, this mining area doesn't seem to want to cooperate with my script. I'll keep it the way it is (slightly) as long as it works.  I suspect that since it was created with 'special magic', and resides on the 0 z-axis, it will always be a little funky.