ID:172174
Jun 19 2004, 3:15 pm
|
|
While trying to become better at DM, I need to know about lists. THe DM reference doesnt help... How do i do lists? can I have a small snippet?
|
In response to Theodis
|
|
just to kinda get a better idea i pasted it into a dm file then ran it and it ave me these erros
bad argument definition 3 times at the string 2 string 3 and for(var thingy |
In response to Konamix
|
|
That code won't run. It's just a bunch of examples of the type of things you can do with lists.
I suggest you check out Chapter 10 of the DM Guide. (The link to the full guide is on the left.) |
In response to Crispy
|
|
OK, let me get my question out. If I made a list like this
mob proc Log2() var/list/classes classes = new() classes.Add("Warrior") classes.Add("Paladin") is what I have is that.. I want it to bring up a selection list where it shows what i have in the list like --------------- -Warrior - -Paladin - -Cancel - --------------- then would i usr if("Warrior") to see if thats what they picked? |
In response to Konamix
|
|
This should work. "in classes" represents all the things in the classes list and you add "Cancel" to the choices also with +list("Cancel") .
var/M = input("What class would you like to choose?","Class") in classes + list("Cancel") |
In response to Konamix
|
|
thanks a lotz turles
|
In response to Turles9000
|
|
Rather than adding a "Cancel" option, I prefer to do the last bit of the input() like this:
in classes as null|anything That way, a cancel *button* will appear on the dialog. Much nicer. =) |
In response to Crispy
|
|
That code won't run. It's just a bunch of examples of the type of things you can do with lists. The only thing it lacks is a place to be run :P. I know it runs since I threw it in a verb and all was well. |
In response to Turles9000
|
|
Use else if()s there. Always use else if()s when choosing between different options. It's faster and less prone to error.
|
A list is just an ordered(or associated with a key) collection of data.