As one might be able to see, this isn't very efficient at all. I was trying to use the new function in the editor where you can retrieve "multiple" chat strings, but I haven't been successful.
I was wondering if anyone had an idea how to make it so I don't have to have so many If-then-else lines?
Use a switch. Its a general action just like if then else. You might also be able to do to make it even shorter so that you don't need to keep on adding more cases.
Edit: Made a real quick rough trigger of how u can make that much more efficient, and w/o even using a switch or if then else. but it will work for -sens 10 to -sense 40. this is a rough example though so change it to w/e u need
Untitled Trigger 001
Events
Game - Player Any Player types a chat message containing "-sens", matching Partially
As one might be able to see, this isn't very efficient at all. I was trying to use the new function in the editor where you can retrieve "multiple" chat strings, but I haven't been successful.
I was wondering if anyone had an idea how to make it so I don't have to have so many If-then-else lines?
Use a switch. Its a general action just like if then else. You might also be able to do to make it even shorter so that you don't need to keep on adding more cases.
Edit: Made a real quick rough trigger of how u can make that much more efficient, and w/o even using a switch or if then else. but it will work for -sens 10 to -sense 40. this is a rough example though so change it to w/e u need
Untitled Trigger 001
Events
Game - Player Any Player types a chat message containing "-sens", matching Partially
Local Variables
Conditions
(Integer((Substring((Entered chat string), 7, (Length of (Entered chat string)))))) <= 40
(Integer((Substring((Entered chat string), 7, (Length of (Entered chat string)))))) >= 10
Actions
Variable - Set Untitled Variable 002[(Triggering player)] = (Integer((Substring((Entered chat string), 7, (Length of (Entered chat string))))))
@gizmachu: Go
Thanks!
I ended up using the switch though. I just learned something new, thanks for that.
Yeah i think a switch is the best you'll get
@gizmachu: Go
Imho this is the "right" way to do this, except the multiple calculation of
Better to use a variable here. It is more efficient, easier to read and less error-prone.