ScriptUO
Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: Grandewd on October 10, 2013, 02:39:29 AM
-
Probably most of you here already have a sub to do this, but maybe not all...
Anyway, after all these years of knocking tables over, and bashing into walls and even occasionally running over the edge of my houses foundation - I decided that it was really stupid that I didn't write a little sub to ALWAYS have me WALK in my house - without me having to hit a freekin' key or click a menu every damn time... I mean if we can write scripts that fight or mine or whatever for us, then we should certainly be able to have our char always walk when he/she's in the damn house (and other places to, like the bank) - AUTOMATICALLY.
So I sat down and look'd at the wiki and it dawned on me that we have an event macro toggle for walk/run (I know - it's assigned to my F9 key and a button on damn near every menu I've got)...
And then I said to myself, hmmmmm.... that shows up as a message whenever it's toggled.... So why not have a sub that hits that toggle and then acts according to what it tells me?
And by jove, it works almost perfectly....
Here's where TM or EN or one of you elites can help me perfect this little bugger.... I have to almost try to get it to fail, but it will fail the way it is - which is, of course, unacceptable...
Here's what it does wrong:
IF I run it 2 or 3 times in a row, (so nothing is in the journal besides the walk/run off/on message) it will take the wrong action and switch wrongly.
I'm sure that it has to do with my usage of TM's TravelFromRunebook sub that it depends on to check the journal message....
What would be the correct parameter in this case?
Here's the sub:
Sub WalkAtHome
event macro 32 0 ;run On/Off
wait 3
gosub TM_AdvJournalScan WalkRun VALID_ADVANCE now_on
if #RESULT = #TRUE
{
event macro 32 0 ; Toggle it Off
wait 3
}
else
{
wait 1
}
Return
I know how Kal In Ex would code this.... His script would say: "If you're on any one of the tiles within this boundry, then you will walk."
Well, he's smarter than I am when it comes to this stuff...
-
Couldn't you just use a rail and then call to it when you want to walk?
-
Well someone who is familiar with tms journal subs is going to have to answer the specifics on this question .. but I would say you need something that resets/sets the journal start position right before you do the event macro command.
-
Well someone who is familiar with tms journal subs is going to have to answer the specifics on this question .. but I would say you need something that resets/sets the journal start position right before you do the event macro command.
Yea, exactly... Hopin' TM might come across this and respond...
-
Couldn't you just use a rail and then call to it when you want to walk?
Sure, I use a short rail whenever I go home... But that doesn't address the need to always WALK, not run... If he's already walking, do nothing. If he's running, make him walk.... Then kick in the rail to move...
-
TM often tell me to play with VALID option try this and see it if work better and let hope you have the sub at the right place too.
gosub TM_AdvJournalScan WalkRun VALID now_on
-
This just relies on #sysmsg, first saw this trick in an RK script ... presumes you don't mess with run/walk status except via the walkrun sub:
set %isrunning x ; 0 - walking, 1 - running
gosub init
display ok %isrunning
gosub walkrun
display ok %isrunning
halt
; places client and isrunning in known state (walking).
sub init
repeat
set %temp #sysmsg
if Always_Run_is_now_off. in %temp
{
set %isrunning 0
return
}
wait 2
event macro 32 0
wait 3
until #false
return
; %0 0 - toggle; %1 0 - walk, 1 - run
sub walkrun
if %0 = 0
goto toggle
if %1 = %isrunning
return
toggle:
event macro 32 0
set %isrunning ( %isrunning + 1 ) % 2
wait 3
return
-
TM often tell me to play with VALID option try this and see it if work better and let hope you have the sub at the right place too.
gosub TM_AdvJournalScan WalkRun VALID now_on
Yup, that's exactly what I just tried... And so far, it hasn't failed....
-
This just relies on #sysmsg, first saw this trick in an RK script ... presumes you don't mess with run/walk status except via the walkrun sub:
set %isrunning x ; 0 - walking, 1 - running
gosub init
display ok %isrunning
gosub walkrun
display ok %isrunning
halt
; places client and isrunning in known state (walking).
sub init
repeat
set %temp #sysmsg
if Always_Run_is_now_off. in %temp
{
set %isrunning 0
return
}
wait 2
event macro 32 0
wait 3
until #false
return
; %0 0 - toggle; %1 0 - walk, 1 - run
sub walkrun
if %0 = 0
goto toggle
if %1 = %isrunning
return
toggle:
event macro 32 0
set %isrunning ( %isrunning + 1 ) % 2
wait 3
return
Hey ximan... I LOVE your use of #sysmsg to accomplish the same thing... Sorta brilliant.... I haven't tried it yet, but I did read thru it and certainly theoretically it should work perfectly... :o
I'll give it a shot later and let ya know...
Oh, and thanks for responding...
-
This just relies on #sysmsg, first saw this trick in an RK script ... presumes you don't mess with run/walk status except via the walkrun sub:
set %isrunning x ; 0 - walking, 1 - running
gosub init
display ok %isrunning
gosub walkrun
display ok %isrunning
halt
; places client and isrunning in known state (walking).
sub init
repeat
set %temp #sysmsg
if Always_Run_is_now_off. in %temp
{
set %isrunning 0
return
}
wait 2
event macro 32 0
wait 3
until #false
return
; %0 0 - toggle; %1 0 - walk, 1 - run
sub walkrun
if %0 = 0
goto toggle
if %1 = %isrunning
return
toggle:
event macro 32 0
set %isrunning ( %isrunning + 1 ) % 2
wait 3
return
Since you posted this ximan, I've use it in my script and it hasn't failed yet.... So tyvm....
I just can't seem to get the job done using scanjournal... I'm beginning to wonder if you can use scanjournal to reliably tell you which walk/run state you're currently in... Would love it if someone could get that method to always work so I could see what I'm doing wrong...
In the meantime, you'rs works perfectly... But it doesn't get me that submission I wanted... :)
-
So much effort for something that is one line in stealth :X
function MoveXY(Xdst, Ydst:Word; Optimized:Boolean; Accuracy:Integer; Running:Boolean):Boolean
To walk:
MoveXY(1,1,True,0,False);
or to Run:
MoveXY(1,1,True,0,True);