[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ VBscript ➜ if then else or do/while needed in alias

if then else or do/while needed in alias

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Babochka   USA  (21 posts)  Bio
Date Fri 06 Jan 2006 09:23 PM (UTC)
Message
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!
Top

Posted by Metsuro   USA  (389 posts)  Bio
Date Reply #1 on Sat 07 Jan 2006 03:51 PM (UTC)
Message
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.

Everything turns around in the end
Top

Posted by Metsuro   USA  (389 posts)  Bio
Date Reply #2 on Sat 07 Jan 2006 04:18 PM (UTC)
Message
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

Everything turns around in the end
Top

Posted by Babochka   USA  (21 posts)  Bio
Date Reply #3 on Wed 11 Jan 2006 01:38 AM (UTC)
Message
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.
Top

Posted by Nick Gammon   Australia  (23,046 posts)  Bio   Forum Administrator
Date Reply #4 on Wed 11 Jan 2006 02:21 AM (UTC)
Message
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

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Babochka   USA  (21 posts)  Bio
Date Reply #5 on Fri 13 Jan 2006 07:39 AM (UTC)
Message
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.

Top

Posted by Babochka   USA  (21 posts)  Bio
Date Reply #6 on Fri 13 Jan 2006 09:10 AM (UTC)
Message
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?
Top

Posted by Shadowfyr   USA  (1,787 posts)  Bio
Date Reply #7 on Fri 13 Jan 2006 04:36 PM (UTC)
Message
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.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


33,110 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]