ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: Ketchup on September 20, 2015, 07:32:00 AM

Title: Issue with a sub of mine
Post by: Ketchup on September 20, 2015, 07:32:00 AM
I'm having an issue when calling this sub for the 2nd time in my script, firstly it runs to my first rail great, runs to bank, deposits and then upon calling the rail sub for the second time it does nothing, anyone have an idea why?
without adding my whole script this is what it looks like

This is my little call for subs in my checkweight sub, why would the 2nd call not work? any help appreciated!

 gosub runrail RailOne
        wait 2s
        gosub recall_to_bank
        wait 1s
        gosub deposit_items
        wait 1s
        gosub recall_to_dungeon
        wait 1s
        gosub runrail RailTwo

Code: [Select]



;--------------------------------------------------------------
;--------------------------------------------------------------
sub runrail
msg Dungeon Despise$
wait 2s
     namespace push
     namespace local MR , #systime

     set !Cnt %1 , Cnt
     set !Cnt % . !Cnt
     set !SX %1 , X
     set !SY %1 , Y

     for !i 1 !Cnt
     {
         set !nX !SX , !i
         set !nY !SY , !i
         set !nX % . !nX
         set !nY % . !nY

         move !nX !nY 0 5s   ;you might have to adjust timeout depending on move length
     }

     namespace clear
     namespace pop
return
Title: Re: Issue with a sub of mine
Post by: The Ghost on September 20, 2015, 08:55:03 AM
First, does the sub work on his own.  If yes,  then you can try adjusting the wait time.   

I use this to quickly change them.
set %swait  20  <--- increase the number as u see fit.
Title: Re: Issue with a sub of mine
Post by: Ketchup on September 20, 2015, 10:45:10 AM
the sub works on it's own yes, when I call gosub runrail RailOne, it works fine but upon the call of the gosub runrail RailTwo it says the dungeon part but then doesn't move, I cannot work out why
Title: Re: Issue with a sub of mine
Post by: The Ghost on September 20, 2015, 12:56:42 PM
Not sure but maybe it miss a 1

Code: [Select]
namespace push
     namespace local MR , #systime

     set !Cnt %1 , Cnt
     set !Cnt %[font=Verdana]1[/font] . !Cnt      < ------  should be a 1 there by any chance
     set !SX %1 , X
     set !SY %1 , Y

     for !i 1 !Cnt
Title: Re: Issue with a sub of mine
Post by: Ketchup on September 20, 2015, 01:48:55 PM
thanks for your replies ghost I'll give that a try and see if it makes a difference and let you know
Title: Re: Issue with a sub of mine
Post by: Ketchup on September 20, 2015, 01:57:05 PM
Adding the number 1 made the first run rail not even attempt to move, so I feel it's not because of that
Title: Re: Issue with a sub of mine
Post by: KaliOfLS on September 22, 2015, 11:08:56 AM
My move sub!  I would make sure you've named the rail properly.  Like makes ure it is %RailTwoX1 and %RailTwoX2  not like %RailtwoX1 or something, caps matter.
Otherwise add
display ok !nX , #spc !nY

right before the move line, and see if those are coming up correctly. 

Title: Re: Issue with a sub of mine
Post by: The Ghost on September 22, 2015, 12:50:33 PM
I rename the railTwo and got it to work. I PM him the right systax
Title: Re: Issue with a sub of mine
Post by: Ketchup on September 27, 2015, 02:40:19 AM
Ghost, thanks for your reply but it didn't work, anyway, Kali, I tried it and when it gets to rail two it says RailTwoX N/A RailTwoY N/A
Title: Re: Issue with a sub of mine
Post by: The Ghost on September 27, 2015, 04:30:01 AM
in the PM with both rail that have the same location.  In that PM just copy and paste that railtwo into your build. 
Title: Re: Issue with a sub of mine
Post by: KaliOfLS on September 28, 2015, 10:45:04 AM
The N/A means that the locations aren't set.  Which either means you forgot to initialize the variable values, or the name is incorrect.  Since ghost is saying that he fixed it by adjusting the rail name, I think it is the latter.
Title: Re: Issue with a sub of mine
Post by: Ketchup on October 07, 2015, 09:20:14 AM
Ghosts fix does not work for me
Title: Re: Issue with a sub of mine
Post by: The Ghost on October 07, 2015, 11:28:38 AM
Let try this again.     after you use the command Dungeon XXXXXXX , you have issue with running rail two to get to your destination.  Correct
Title: Re: Issue with a sub of mine
Post by: Ketchup on October 08, 2015, 01:13:21 AM
okay, rail 2 gets me out of the dungeon before recalling to the bank, rail 1 takes me into the dungeon before killing
Title: Re: Issue with a sub of mine
Post by: KaliOfLS on October 18, 2015, 01:24:09 PM
Okay, there can be a problem.  If it is running to the door and then doing funny things, that is because the inside of the dungeon and the outside of the dungeon are non-contiguous in the UO world coordinate system.  Look at automap or something.  What happens in X,Y cooridnates is this:

Code: [Select]
X: 100 Y: 100
X: 104 Y: 100
X: 108 Y: 100  ;Last outside tile
X: 504 Y: 200  ;First inside tile
X: 508 Y: 200

So your character hits that last tile that you marked outside and b-lines right for the other tile in some strange direction and not into the dungeon.  You have to insert an x,y value that is like 1 tile into the 'black area' of the dungeon tile or something.
Title: Re: Issue with a sub of mine
Post by: Ketchup on October 28, 2015, 08:22:32 AM
sadly I don't think that is the problem either, it uses the dungeon portal and then just sits still, the tile it should be going to is not through a dungeon entrance as he's already in there, it just stops dead