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, confirm your email, resolve issues, 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.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ VBscript ➜ how do i repeat a command in VB script?

how do i repeat a command in VB script?

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


Posted by Babochka   USA  (21 posts)  Bio
Date Sat 27 May 2006 06:32 AM (UTC)
Message
Hello

I'm Babochka and I love to play Achaea as Cymru, a Rajamalan Druid. Druids can harvest herbs which they use to brew elixirs.

I may come into a room and see the following:

The following plants are growing in this room:
A ginseng plant (ginseng) 26 left.
A myrrh bush (myrrh bush) 11 left.
A lobelia wildflower (lobelia) 21 left.
A purple coneflower (echinacea) 13 left.
A red elm tree (red elm) 20 left.
A wild ginger plant (wild ginger) 39 left.

I need to harvest the ginseng. What I would do is type 'harvest ginseng' 14 times! Can't I create an alias or something like:

harvest * *

for w = 1 to %1
harvest %2
next w

i would enter harvest 14 ginseng and it would harvest 14 ginseng with typing it 14 times

Can you help me? Thanks.

Top

Posted by NeoFryBoy   USA  (42 posts)  Bio
Date Reply #1 on Sat 27 May 2006 08:44 AM (UTC)
Message
Well, The wildcards need to be separated, since the two of them together like that amkes it impossible for MUSH to determine between the two.

My suggestion is something like this:

harvest *|*

then set it to send to script...

dim w

for w = 1 to %1
world.send "harvest %2"
next


Use: harvest 10|ginseng
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #2 on Sat 27 May 2006 08:46 AM (UTC)
Message
For one thing, you can type Ctrl+R to repeat the last command, so you only need to type "harvest ginseng" once, and then hit Ctrl+R to keep doing it.

You can easily make an alias to to the "repeat n times" idea as well.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 27 May 2006 08:50 AM (UTC)
Message
Also read this post, it discusses a number of ways of doing it:

http://www.gammon.com.au/forum/?bbsubject_id=3311

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #4 on Sat 27 May 2006 08:54 AM (UTC)
Message
So as that post said (amongst other ideas), if you have speedwalking enabled, and "#" as your speedwalk prefix, all you would have to type is:

#14 (harvest ginseng)

- Nick Gammon

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

Posted by NeoFryBoy   USA  (42 posts)  Bio
Date Reply #5 on Sat 27 May 2006 09:07 AM (UTC)
Message
Which is actually more characters to type than the alias idea. :P
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #6 on Sat 27 May 2006 10:08 PM (UTC)
Message
Yes, well I was demonstrating how you could do it without even needing an alias.

This alias here requires less typing again. For example, the "|" will be a pain to type:


<aliases>
  <alias
   match="^h (\d+) (\w+)$"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>
for i = 1 to %1
  Send "harvest %2"
next
</send>
  </alias>
</aliases>


Now you just type: h 5 ginseng


- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


26,138 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

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