About variable in the DoAfter .

Posted by Leera2008 on Fri 18 Jun 2004 04:37 AM — 9 posts, 30,438 views.

#0
my trigger like these:

exe = int(kee - max_kee/2-800)
world.note exe
world.doafter 4, "exercise exe"

cant execute right.

How to send the variable in "DoAfter"£¿
Australia Forum Administrator #1
Concatenate them together, like this:


exe = int(kee - max_kee/2-800)
world.doafter 4, "exercise " & exe
#2
Thank You.
So earlier U get up?
*admire

and I fell the variable in the mushclient and the variable in Scripts are 2 kinds of things. right?

Variable "A" in mushclient and variable "A" in the script are not equal, right?
USA #3
yes, one is only in the script, and it goes away if you reload the script, or restart Mushclient. Also, if you CREATE it inside of a sub, it only sticks around for as long as the sub.

Mushclient variables stick around in your world file.

However, you can use
world.getvariable ("variable")
and
world.setvariable "variable", "value"

to get and set mushclient variables so you can use them in scripts, and then store them for later usage.
Australia Forum Administrator #4
Quote:

So earlier U get up?
*admire


Well, as I live in Australia, it is around 4 pm. So, I got up quite a while ago. :)
#5
hehe.
Many Questions I have .(sorry)

foods = world.getvariable("foods")

I want this line happen at 1 second later .

How to put this line in DoAfterSpecial?
Australia Forum Administrator #6
It sounds a strange thing to want to do, but to do it you would:


DoAfterSpecial 1, "foods = world.getvariable(""foods"")", 12


That sends that command to "script" which executes it as a script.

However I'm doubtful why you would do that, perhaps you should explain the reason for it.
#7
:)

I m doing a Auto Recover robot.

1."hp " get the varibles from a mutiline trigger.
2. Wait some second until hp trigger get right variables
3. Do recover according to the variables just get.

If there is no the 2nd step "wait some second", the 3th step will execute at once after the 1st step which use the variables got last time .
Amended on Sat 19 Jun 2004 01:36 AM by Leera2008
Australia Forum Administrator #8
Yes, but all that does is move a MUSHclient variable into a script variable. It doesn't do anything really useful.

This business of waiting a few seconds is a bit unreliable, what if the trigger fires after 1 second? After 10 seconds?

You are better having the trigger (which matches on the HP) doing itself what needs to be done, not putting something into a variable and testing the variable 5 seconds later.