I'm trying to make a UI element that players can type any number, say 300 into and then click the button to run a script that relies on the entered integer.
I am newer to Starcraft map making and I do not understand the galaxy script editor. If I can make a textbox without having to use the galaxy script editor then that would be preferred.
Quote from willuwontu:
Make and edit box, and a button. Have an dialog item clicked event, and use the string value from the edit box (convert it to integer or what not)
----
Yeah, That!
Keep in mind to add in a condition to null values you dont like (like values with letters in them). If someone puts in "-200" will it break the game? or "10F00"
By default when you convert any nonstring value to a number, it will result in the number being 0 and throw an error. I'm not positive but I don't think throwing an error causes performance issues, and if your range of numbers does not include zero this shouldn't be an issue. If you need to include zero in your range, then you'll need to do some more advanced exception handling, which I personally don't know how to do with the trigger editor.
I'm trying to make a UI element that players can type any number, say 300 into and then click the button to run a script that relies on the entered integer.
I am newer to Starcraft map making and I do not understand the galaxy script editor. If I can make a textbox without having to use the galaxy script editor then that would be preferred.
create a dialog. there is a dialog item for it; but the name escapes me; i think it is letterbox.
either way, you can get the entered value, and use it.
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
Make and edit box, and a button. Have an dialog item clicked event, and use the string value from the edit box (convert it to integer or what not)
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
Quote from willuwontu:
Make and edit box, and a button. Have an dialog item clicked event, and use the string value from the edit box (convert it to integer or what not)
----
Yeah, That!
Keep in mind to add in a condition to null values you dont like (like values with letters in them). If someone puts in "-200" will it break the game? or "10F00"
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
By default when you convert any nonstring value to a number, it will result in the number being 0 and throw an error. I'm not positive but I don't think throwing an error causes performance issues, and if your range of numbers does not include zero this shouldn't be an issue. If you need to include zero in your range, then you'll need to do some more advanced exception handling, which I personally don't know how to do with the trigger editor.
You can check if a string can be converted to an integer by doing a search & replace of all digits to "" (nothing) and then checking string length.