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
Petrograd
Novice


Joined: 08 Dec 2005
Posts: 35
Location: Sweden

PostPosted: Fri Sep 08, 2006 1:17 am   

Advanced variable question
 
I use
:charname: do whatever
to be able to make my alt do things without me interfering.

Now, I have a 8 variables named char1, char2 up to char8 (not made into a variable, because that'd be ickier to change without having to go into settings).
So, when I wanted @char2 to do whatever, I spent some time thinking and found this solution to the problem:
:<@char2>: do whatever
Now I want a trigger to make them all do an action. How many I have logged varies (put in @shownalts), anything from 1 to 8, but if I use the alias I wont want char1 to do it, but char2 up to how many I got, so sometimes only char2.

Using @i as a variable, I could do this something like this:
i = 2
#while (@i < @shownalts+1) {
:<@char<@i>>: @action @tar
#add i 1
}

with the action kill and tar mob, I would want it to send
:(char2's name): kill mob
and so on with the other chars, depending on how many I got

However, :<@char<@i>>: doesn't work :P
There weren't much discussion on :<@variable>: stuff at all, so I wasn't surprised when I couldn't find my solution in previous posts.
Reply with quote
Petrograd
Novice


Joined: 08 Dec 2005
Posts: 35
Location: Sweden

PostPosted: Fri Sep 08, 2006 1:20 am   
 
This does what I want, but is ugly:

#if {@shownalts >= 2} {
:@char2: @action @tar
#if {@shownalts >= 3} {
:@char3: @action @tar
#if {@shownalts >= 4} {
:@char4: @action @tar
#if {@shownalts >= 5} {
:@char5: @action @tar
#if {@shownalts >= 6} {
:@char6: @action @tar
#if {@shownalts >= 7} {
:@char7: @action @tar
#if {@shownalts == 8} {:@char8: @action @tar}
}
}
}
}
}
}
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Sep 08, 2006 2:46 am   
 
Try it with braces:

@{char@i}
_________________
EDIT: I didn't like my old signature
Reply with quote
Petrograd
Novice


Joined: 08 Dec 2005
Posts: 35
Location: Sweden

PostPosted: Fri Sep 08, 2006 3:40 am   
 
Hehe, that worked, thanks!
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