|
Indica Beginner
Joined: 25 Mar 2003 Posts: 18
|
Posted: Sat Apr 02, 2005 8:55 am
Problems using #forall/#loop |
Hi,
I'm trying to use forall or loop in a context that my variables actually have a number ending w/ a number corresponding, um hard to descript but heres the code:
Code: |
#FORALL @total_mobs {
#IF (@monster%i > 0) {
@attack @mob_nameTi
#ADD monster%i -1
#ABORT
}
} |
what happens is it will send @attack and what ever reapeat its on so @attack 10 for the 10th loop, any way to use forall/loop in this context or do i just need to create triggs for each?
THanks
Josh |
|
|
|
Theragil Apprentice
Joined: 13 Feb 2004 Posts: 157 Location: USA
|
Posted: Sat Apr 02, 2005 1:25 pm |
Try referring to your variable as @{monster%i}.
|
|
|
|
Indica Beginner
Joined: 25 Mar 2003 Posts: 18
|
Posted: Sat Apr 02, 2005 7:43 pm |
well i see whats basically happening now is this
#LOOP 1,10 {@mob_name%i}
instead of interpreting thevariable w/ the %i on the end it interprets the variable @mob_name and then the %i so it send @mob_name and then the %i to the mud....
i've tried @(mob_name%i) but thats not valide in zmud, i've tried @mob_name(%i), @mob_name%(i), (@mob_name%i)
Anyway for it to put the %i in before it interprets the variable? |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sat Apr 02, 2005 8:31 pm |
#EXECUTE @attack
|
|
|
|
Indica Beginner
Joined: 25 Mar 2003 Posts: 18
|
Posted: Sat Apr 02, 2005 9:06 pm |
using this
#LOOP 1,10 {#EXECUTE @mob_name%i}
it still interprets the var then the %i, is what i want just not possible??? |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sat Apr 02, 2005 9:35 pm |
#LOOP 1,10 {#EXECUTE @{mob_name%i}}
|
|
|
|
Theragil Apprentice
Joined: 13 Feb 2004 Posts: 157 Location: USA
|
Posted: Mon Apr 04, 2005 12:44 pm |
Actually I think @attack @{mob_name%i} should work. You tried parentheses and stuff, but it's curly brackets you need like I replied originally. The #exec probably isn't needed, but it can't hurt.
#send might be even better if @attack doesn't point to an alias, though #send is a little wonky when it gets multiple parameters, so you need to futz about with %concat() and maybe %eval(). But the advantage is it doesn't echo even if you have things set to echo, so it's good to avoid spam without making your logs useless.
(Aside: we so need to be able to gag things from the screen but not the log! |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Mon Apr 04, 2005 7:18 pm |
Quote: |
#send is a little wonky when it gets multiple parameters, so you need to futz about with %concat() and maybe %eval(). |
Have you tried #SEND {multiple paramaters} |
|
|
|
Theragil Apprentice
Joined: 13 Feb 2004 Posts: 157 Location: USA
|
Posted: Mon Apr 04, 2005 8:47 pm |
There's a few ways to do it, that's one of them. Just don't think the OP wants to mess with that right now.
|
|
|
|
|
|