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
isop
Newbie


Joined: 20 Oct 2004
Posts: 5

PostPosted: Fri Dec 03, 2004 8:10 am   

Help with string list variables
 
Hello all, I was hoping someone could give me some general help with string lists, and their usage. I have simplified my problem, as the triggers are quite complicated, but I have each of the elements working properly, and just need to make them work together using string list instead of having individual variables.

I have a string list which is used in a number of areas

First, lets say the variable is "list"
So, I have a few commands which make the list be orc|goblin|dog
These commands work properly, so far.
Now, I want to be able to use this list in a few ways.

(1)
First, I would like to be able to use it in general command lists... for example, I want to send a command to the mud directly, such as

kill orc

I want to do this by using my list, though, so I thought it would look like
kill %item(@list,1)

When I do this as a #SHOW, it returns the proper output "kill orc", but it doesn't when I send the command direct to the mud. All I see is the full command, with the %item in it. What do I need to do to get my command line to properly expand this statement?

(2)

I then, have another command, which will make the second half of the %item function change. I have set up a variable, @listno, which changes properly based off another trigger.

I want to take the list information, and make it an alias... so as @listno changes, the alias will change.

What I have tried to do, unsuccesfully, is
#alias killlist {kill %item(@list,@listno)}

This does not seem to do very much, as yet, but I have a funny feeling once I figure out (1) I will be in better shape here. I have seen a few areas where expansion does not seem to work properly within an alias or trigger before, so I figured I would insert it here.


(3)

I also want to be able to use this item in a few triggers... one which uses the #until command

It looks something like this
#Var listno 1
#Until @listno=%numitems(@list) {kill %item(@list,@listno);#add listno 1}
IF @listno=%numitems(@list) {pat dog}

As you can see, I may also be needing some help with the #until command, but it appears the trigger I have is all parsed properly, all I need is to better understand the variable expansion section of string lists, and proper usage. I only put this here so you can see the concept I am fully going for.

Any and all help is appreciated... I am sure there is something simple I am missing! If a guru can think of a more effective way to do this, please feel free to give the suggestion! I am really just trying to work out all of the powers of Zmud, and their practical applications (well, as practical as mudding can be!)

Isop
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Fri Dec 03, 2004 1:39 pm   
 
1. You need to force expansion with <> make sure in your view-prefrences-script parser that 'allow <> for expansion' is checked
EXAMPLE: kill <%item(@list,1)>
NOTE Only use this for things YOU enter into the command line not in a script.

2. #alias killlist {kill %item(@list,@listno)} should work as intented check your prefrences again and make sure that 'Expand Vars' is Unchecked

3. Should work as is but I don't really use While or Until so.... however surround your expression pattern with ()'s #UNTIL (@listno=%numitem(@list)) {etc etc etc}
_________________
Zmud Support Library
Zmud Knowledge Base
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