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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Tue Apr 29, 2008 10:40 pm   

Stringlist
 
You guys seem to know this site far better than me. Can someone link me some stringlist help? And also, knowing that I'll be using it for the attack types, any suggestions that the help might not cover?
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Tue Apr 29, 2008 11:21 pm   
 
There's not a lot to say except this. If you have any specific questions, just ask them.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed Apr 30, 2008 3:31 am   
 
So how do I create a stringlist? I was told it could be managed similar to a database? But the syntax I see is just like any normal variable.

Also, I'd like to keep the values inside a .txt file for easy transfer/replacement, would copying and pasting values already in the variable cause problems?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4715
Location: Pensacola, FL, USA

PostPosted: Wed Apr 30, 2008 4:33 am   
 
its a type of variable

variable="item1|item2|item3"
#VAR variable {item1|item2|item3}

#ADDITEM for single instance
%additem for multiple instance
%ismember to check
_________________
Discord: Shalimarwildcat
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed Apr 30, 2008 1:11 pm   
 
The variable you have defined there seems different from what I'm used to declaring

#var <name> value default_value {class}

Also, I saw that on the page and I have it book marked. I guess I wasn't really clear when I made that statement.

It appears just like any other normal variable, it's properties just seem to define it. But I heard it could be edited like a database? (long list of entries in fields)

And since I keep a lot of stuff in .txt file, if I copy and pasted everything, including new values, to the new variable, would it overwrite ones that matched exactly the same?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Wed Apr 30, 2008 1:45 pm   
 
I think I understand the questions.

You can define the string list variables the way you are used to doing variables.

#VAR variable {item1|item2|item3} _nodef {class}

Any regular variable can be made into a string list by simply setting its value to a list separated by vertical bars.

#var normvar "I'm a string variable."

normvar = "String1|String2|String3" //It is now a string list variable.

If you edit these variables via the package editor they will show up as you say like a database variable.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Wed Apr 30, 2008 1:45 pm   
 
#var <name> value default_value {class}
#var <name> {apple|banana|carrot} default_value {class}

It is as it is named a stringlist is a list of strings as you can see which is stored in a variable. You can edit it by using the commands that shalimar listed above. Of course there are more commands to edit it which you can find on the page that Fang linked for you. As for editing it like a database as you can see from the linked page there are commands that are equivalent to select, insert, update and delete so sure if you like the comparison stick with it otherwise treat it as a new friend that you have to get used to.

#var testofstringlist {this|does|not|exist}
#var testofstringlist {hello|world}
#forall @testofstringlist {#echo Item: %i}

Copy and paste the above lines into the CMUD command line and press enter, you should end up with the following displayed on screen

Item: hello
Item: world

So as you can see if you keep your stringlist in a text file and it contains everything you need in it every time you copy and paste it into the command line you will get everything you need in your stringlist, basically it overwrites it. So like you say if you keep your text file up to date with new values and copy and paste it in it will overwrite what you already have, if you define a new variable name it will create a new variable with all your up to date entries.

EDIT: Ninja! You've got to love it when that happens, just pipped to the post on the same minute while posting the same information. Twisted Evil
_________________
Taz :)
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Wed Apr 30, 2008 1:52 pm   
 
Yes well Taz, you did give a bit more info than I did. So it's all good. Cool
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed Apr 30, 2008 2:18 pm   
 
Thanks
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
gamma_ray
Magician


Joined: 17 Apr 2005
Posts: 496

PostPosted: Wed Apr 30, 2008 9:38 pm   
 
Hey, I was the one who mentioned that to you (I think)...

In scripts, you can also use #additem #delitem %additem and %delitem (besides command v. function, %additem will add a duplicate if the string list already contains that item, while #additem won't, and #delitem will delete every instance of the item in the string list while %delitem will only delete the first).

But really the way for you to go for what you're doing is just using the GUI in the settings editor.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Thu May 01, 2008 12:32 am   
 
can I export the list?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Thu May 01, 2008 1:15 am   
 
You can yes.

Highlight the variable in the tree view, right click it, select copy, then paste it into a text file.

You could also set the variable to string literal, highlight the value, copy it.

Then do

#var varname {paste stuff here} _nodef {class}
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Thu May 01, 2008 1:35 am   
 
how do I set the variable to string literal?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Thu May 01, 2008 1:44 am   
 
When you have the variable highlighted in the tree view you can edit the values of the variable.
There is a label that says type, usually it says Autotype, but it is a drop down list, Select the String (literal) item in that list.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Thu May 01, 2008 2:10 am   
 
thanks
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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