| Blockland Forums > Modification Help |
| Using a switch to create a selectable list |
| << < (2/2) |
| SpreadsPlague:
by the way it's currently looking for a "1" or a "2" after /potion change the "1" in "case 1" to whatever you want if you want to make it "health" or whatever "case health" would make it look for "/potion health" --- Quote from: Obibital on July 26, 2010, 11:54:24 AM ---Ok then, ive got the switch working fine, and now all i have to set up is the checks for the ingredients. im planning on using if(%client.ingredient1 > 0 Ect...... Is that a bad idea? --- End quote --- I don't know if there's a more efficient way to do this, but that sounds fine if there is a more efficient way, someone will tell you |
| Obibital:
--- Quote from: SpreadsPlague on July 26, 2010, 11:57:48 AM ---by the way it's currently looking for a "1" or a "2" after /potion change the "1" in "case 1" to whatever you want if you want to make it "health" or whatever "case health" would make it look for "/potion health" --- End quote --- Really? because of the appendix i was under the impression that switches could only read numerical values |
| SpreadsPlague:
well you could always try it and see if it works, I'm a little bit rusty at the whole server-sided coding thing, but it looks like it should work. I recall an add-on that did this with nodes, and it used the "case" thing so I'll go dig that up and tell you what I find .. I had to dig up FFC. ew. anyways here's a snippet from FFC using a switch to handle text input --- Code: --- switch$(%Color) { case "":%Player.mountimage(DogImage,1); case "red":%Player.mountimage(DogRedImage,1); case "blue":%Player.mountimage(DogBlueImage,1); case "pink":%Player.mountimage(DogPinkImage,1); case "green":%Player.mountimage(DogGreenImage,1); case "black":%Player.mountimage(DogBlackImage,1); case "white":%Player.mountimage(DogWhiteImage,1); case "yellow":%Player.mountimage(DogYellowImage,1); case "orange":%Player.mountimage(DogOrangeImage,1); case "purple":%Player.mountimage(DogPurpleImage,1); } --- End code --- so yes you can use case with non-numerical values |
| Obibital:
Well, the named case does work, but it tells me in the console that that string always evaluates to 0 Still it worked :p |
| Navigation |
| Message Index |
| Previous page |