|
Mad_geezer Newbie
Joined: 05 Dec 2010 Posts: 8
|
Posted: Sat Dec 18, 2010 3:46 am
How to delay loop ? |
<alias name="pickherb" parsearg="false" id="805">
<value>#t- apples
#var herbloop %2
#var herbpick %1
#loop @herbloop {pick @herbpick;#wa 2800}
plant @herbpick
#YESNO "continue to prepare herbs ?" {#loop @herbloop {prepare @herbpick;#wa 2800}}
#loop @herbloop {inp @herbpick}
herblist</value>
</alias>
All goes well untill the YESNO command then herbs are still prepared after a timedelay but the next loop command is fired before the YESNO loop is finished
I imagine its a {} [] () missing - its worked fine and dandy in ZMUD .. |
|
|
|
Fizgar Magician
Joined: 07 Feb 2002 Posts: 333 Location: Central Virginia
|
Posted: Sat Dec 18, 2010 6:08 am |
Instead of one busy alias like you have above switch to two like I have below and it should work fine.
Code: |
<alias name="pickherb" parsearg="false" id="1">
<value>#t- apples
#var herbloop %2
#var herbpick %1
#loop @herbloop {pick @herbpick;#wa 2800}
plant @herbpick
#YESNO "continue to prepare herbs ?" {continuepick}
</value>
</alias>
<alias name="continuepick" id="4">
<value>#loop @herbloop {prepare @herbpick;#wa 2800}
#loop @herbloop {inp @herbpick}
herblist</value>
</alias> |
A little absent minded this evening... You could also use the same alias you have above and use the #section command to make it work with little change to what you already have. Something like this should work.
Code: |
<alias name="pickherb" parsearg="false" id="4">
<value>#t- apples
#var herbloop %2
#var herbpick %1
#loop @herbloop {#send pick @herbpick;#wa 2800}
#send plant @herbpick
#YESNO "continue to prepare herbs ?" {#section PickLoop {#loop @herbloop {#send prepare @herbpick;#wa 2800}}}
#section PickLoop {
#loop @herbloop {#send inp @herbpick}
#send herblist
}</value>
</alias> |
|
|
_________________ Windows Vista Home Premium SP2 32-bit
AMD Athlon Dual Core 4400+ 2.31 GHz
3 GB RAM
CMUD 3.34 |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Sat Dec 18, 2010 2:01 pm |
The reason your original script worked in Zmud and not in Cmud is that Cmud now uses threading. The #WAIT command has been changed to put the script into a separate thread that runs in the background, in parallel with your other scripts. If you don't want this to end up with multiple parallel threads running at the same time, you may have to rethink your script from scratch.
|
|
|
|
|
|