Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
lorddevi
Newbie


Joined: 13 Jul 2005
Posts: 6

PostPosted: Wed Jul 13, 2005 2:41 pm   

#FORALL Help
 
Pardon me fellows, but I'm having some difficulty with this one. I wish to create what I think is likely a simple script, but can't quite figure it out. I simply wish to have a string variable that contains some mob names. Then I wish to use #FORALL to gate to the mob, perform some commands, and then gate to the next mob in the list and repeat the exact same commands there as well..

I declare the string list with the following example:

Mobs="dwarf"|"cat"|"snake"

However using the example in the help files, the following should work:

#FORALL @Mobs{#SHOW %i}

But it doesn't.. and I am unclear why. From my understanding the latter line should display dwarf, cat, and snake respectivly on thier own lines.

I am aware the following syntax is wrong, but it should easily illustrate the effect I am going for. If anyone can help clarify any part of this to me, it would be appreciated. Playing and experimenting with the help files alone has rather gotten me stuck at this quandary.

Mobs="dwarf"|"cat"|"snake"

#FORALL @Mobs{
mgate %i
enter gate
c gas
}

Then hopefully the product would be a script that created a gate to the dwarf, entered it and gassed it. Then made a gate to the cat, entered it and gassed it, then the same thing with the snake.

Please any constructive pointers at all would be very much appreciated.

Thank you in advance.
Reply with quote
lorddevi
Newbie


Joined: 13 Jul 2005
Posts: 6

PostPosted: Wed Jul 13, 2005 3:13 pm   
 
Looking at this closer it's obvious now I was going about it the wrong way. What I think I should be doing is creating a WHILE loop with a counter..


Mobs="dwarf"|"cat"|"snake"
#VAR mnum=1

#WHILE nnum =< 3 {
mgate @Mobs.@mnum
enter gate
c gas
#ADD mnum 1
(#LOOP?)

The biggest problem probably is that I can find no examples anywhere of how to do any of this stuff :( Only one quick, almost never helpfull, example in the Help pages and that's it. I am still quite unclear as to what the format of these scripts should be.. I mean I know that :

$function {
blah command
}

Is incorrect, but there are no examples. Conversely I do not know how to 'enclose' my while statement.. Please any help would be appreciated.

Plus.. Why can I not use @Mobs.@mnum in place of @Mobs.1 and @Mobs.2 etc..?
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Wed Jul 13, 2005 4:15 pm   Re: #FORALL Help
 
lorddevi wrote:
Mobs="dwarf"|"cat"|"snake"


the help file says
list="sword|ring|shield"

Your prob is prolly the extra "'s

Mobs="dwarf|cat|snake"
#FORALL @Mobs {#show %i}

You were also missing a space between @mobs {
I know, in the help file it LOOKS like @mobs{
but I've learned never to take fonts at face value. I copy and paste into notepad.
At least there it's formatted correctly.
_________________
http://www.Aardwolf.com
Reply with quote
lorddevi
Newbie


Joined: 13 Jul 2005
Posts: 6

PostPosted: Wed Jul 13, 2005 4:41 pm   Re: #FORALL Help
 
Vitae wrote:


Your prob is prolly the extra "'s



Ah yeah, well the 'array' works fine that way, I believe i had problems with the "sword|ring|shield" syntax. At any rate if I :

#SHOW @Mobs.2

For instance it displays 'cat' or whatever the second one happens to be. So that part is correct..

Vitae wrote:

#FORALL @Mobs {#show %i}

You were also missing a space between @mobs {
I know, in the help file it LOOKS like @mobs{
but I've learned never to take fonts at face value. I copy and paste into notepad.
At least there it's formatted correctly.


Ok.. Do you perhaps know how I can use @Mobs.$variable or emulate it? I basically wish to perform a series of commands on the first in the array, then on the second, then on the third etc.. I've tried merely attatching a numerical variable which I could incriment to the @Mobs array. So after the series of commands is complete it will perform the commands on the second element in the array when it loops.
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Wed Jul 13, 2005 5:28 pm   
 
aint sure what your talking about.

but based on what you did before:

Mobs="dwarf|cat|snake"
#FORALL @Mobs {
mgate %i
enter gate
c gas
}

far as i can figure that should work.
dont have an mgate on aard to test it.
and this would classified as a bot, so no way in hell am i even trying it.
_________________
http://www.Aardwolf.com
Reply with quote
lorddevi
Newbie


Joined: 13 Jul 2005
Posts: 6

PostPosted: Wed Jul 13, 2005 5:48 pm   
 
Vitae wrote:
aint sure what your talking about.

but based on what you did before:

Mobs="dwarf|cat|snake"
#FORALL @Mobs {
mgate %i
enter gate
c gas
}

far as i can figure that should work.
dont have an mgate on aard to test it.
and this would classified as a bot, so no way in hell am i even trying it.


Oh got it! All i needed was a #WA 5000 kind of thing after the 'c gas'.. duh

Uh yeah it is a bot. It's for a Godwars mud tho and it's intentionally limited. Even though the Mud itself actually allows for limited botting(skill training etc) I didn't want anything too silly. There are just some mobs that make for good xp that get farmed too much, it can make for very repetative typing.

Thanks alot
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net