if then else or do/while needed in alias

Posted by Babochka on Fri 06 Jan 2006 09:23 PM — 8 posts, 45,379 views.

USA #0
To Life Immortal

Hello I have an occultist character on Achaea. Sometimes he needs to inscribe multiples of a tarot card. I created an alias to draw a single card:

<alias
match="draw *"
enabled="y"
echo_alias="y"
group="tarot"
sequence="100"
>
<send>inscribe blank with %1</send>
</alias>

I want to have an alias which uses either a if/then/else or a do/while so i may create multiples of a card. If there anyway I could create a variable as a counter, and that counter decreases by 1 every time it loops?

Thanks in advance.

2006 will ROCK!
USA #1
I've written a tarot inscribing script once for achaea with Nick's help. If you give me till later today I'll go get it and show you what I did.
USA #2
Well saddly I cant find the one i had done but uh. here the topic... http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4099
USA #3
To Life Immortal

Could someone show me an example of looping in VB Script?

How do I create a FOR-NEXT or FOR-WHILE LOOP?

How do I create a IF-THEN-ELSE?

I need the syntax for these commands and I can not find an example in the MUSHclient help.

Thanks.
Australia Forum Administrator #4
The MUSHclient help is not supposed to teach VBscript. There are help files that do that. However there are examples inside the file exampscript.vbs that comes with MUSHclient.

This page lists where you can get the VBscript help files:

http://www.gammon.com.au/scripts/forum.php?bbtopic_id=2
USA #5
ok I re-read the help files and I'm rying to understand this, so bear with me.

What I want to do is draw more than one tarot card at a time. I couldnt do it, so I decided to create an alias which will draw cards in groups of 3.

I have the alias name draw.

draw *
the * is the tarot card name

then i will have a script called by the alias draw

sub drawmany (name, line, wildcards)
for w=1 to 3
inscribe blank with %1
nest
end sub

My question is how to do pass the tarot name variable to the script. and how do i call the script correctly?

Thanks in advance.

USA #6
Ok I've been experimenting with looping and I think I almost have it:

<alias
match="draw * *"
enabled="y"
echo_alias="y"
expand_variables="y"
send_to="12"
sequence="100"
>
<send>for w = 1 to %1
world.DoAfterSpecial 10, "inscribe blank with %2",0
next</send>
</alias>

The problems is that the alias pauses for 10 seconds, then loops quickly. for example if I type draw 3 priestess, it pauses for 10 seconds then sends 3 inscribe blank with priestess so rapidly, no card get drawn.

How can I slow down the program?
USA #7
You need to use something like:

for w = 1 to %1
world.DoAfterSpecial 10 + w, "inscribe blank with %2",0
next

That would space each draw appart by one second, i.e. 10, 11, 12 and so on. The problem is that you are not telling it with your orginal:

wait for ten seconds, then do ...
wait for 20 seconds, then do ...
etc.

But rather:

wait for ten second, then do ...
wait for ten second + .00000001 seconds, then do ...
etc.

Where the .00000001 is how ever long it takes for the loop itself to execute. It doesn't queue commands with a 10 second delay "between" them, it creates %1 timers, each "exactly" 10 seconds in length.