I'm trying to put all my races in a list and make them equal to a number, so when they pick the number they will select the race.
Help...?
ID:160047
Nov 28 2008, 12:07 pm
|
|
Nov 28 2008, 12:16 pm
|
|
In response to Andre-g1
|
|
You could have it index based, and use actual numbers instead of using an associative list.
|
In response to Kaioken
|
|
Indeed, but is there a difference ? Since both just exist during the duration of the proc.
|
In response to Andre-g1
|
|
Well, it's simpler and more efficient. It also uses actual numbers instead of text strings.
|
In response to Kaioken
|
|
Show me an example..
|
In response to Lundex
|
|
//Andre-G1's edited code a would be equal to the index of what the player selects. It would be a lot easier to cut out the Find() and association altogether and say race = input() instead, though. |
In response to Lundex
|
|
mob/verb/Pick() I think something like this is what he meant. |
In response to Lundex
|
|
The method I said uses a regular list by using the position/order of the items in the list to access them. You could build a list with the available numbers to use and use it as a choices list in input(), or have the player type a number (and then check if it's valid).
|
In response to Andre-g1
|
|
Yeah, that's right. Though you have to check if the player typed in a correct number.
|
In response to Kaioken
|
|
I have a question about something like that to be honest.
Would it work if I did something like: if(index in(1 to 3)) Hum ? |
In response to Andre-g1
|
|
Yes, that's valid syntax (and you don't need the parentheses). Basically a shortcut for a range check, you could also use the >=,&&,<= operators of course.
|