convert player input to integer
pdore
03 Jan 2013, 06:26I'm new to all this but having a blast. Could someone please help me convert a player input variable (string) to an integer. Something like "How many rocks do you take?" and have the player input stored as an integer. Don't know how to use the code yet, so just with the regular editor please. Thanks!!
HegemonKhan
03 Jan 2013, 07:10I'm not quite sure what you're asking, so my apologizes if this isn't what you wanted (and also, I'm a noob too, so you may need to get help from someone else), but if I'm guessing what you meant correctly, you're asking for something that is a bit more complex to do, than you may realize, and you also have to specify more with what you want to do (such as take the rocks from where or how?), anyways, here's my (general usage for now as you need to specify more to me with what you want to do) guess on how to do "this" (hopefully it is what you're asking for, lol):
You're familiar with the basics of the GUI (the noob-friendly mode with the buttons, menus, windows, etc), right?
(if not, I can explain more of what I'm saying)
(do not type in my use of the single quotes, '...', as I'm just using them to highlight what you type into the GUI's stuff)
Functions -> Add -> 'TakingRocks' -> Script ->
Add New Script -> Output (Print A Message) -> 'How many rocks do you take?'
Add New Script -> Output (Get Input), then run script:
->Variables (Set A Variable Or Attribute) -> Set Variable 'player.rockquantity' = [expression] 'result'
Object -> Player -> Attributes (Tab) -> Attributes (bottom big box) -> Add -> 'rockquantity' -> [integer] -> '0'
Object -> Player -> Attributes (Tab) -> Status Attributes (top smaller box) -> Add -> 'rockquantity' -> '_____' (leave blank)
then it's just a matter of where-how you want to get the rocks from-by
for just this general example, I'll put this as a starting script:
Object -> Game -> Script -> Starting Script ->
Add New Script -> Scripts (Call Function) -> Call Function 'TakingRocks' with parameters -> Add (leave blank, don't add any!)
----------------
this is just coding for taking rocks, if you want more general coding, you're going to need to get help from someone else, as general coding is beyong my limited noob knowledge of coding, at the moment (and probably for quite awhile too), lol.
---------------
Edit:
I just realized, using (setting up) a command (if I'm addressing correctly what you're asking for) would be better for what you want, which I think I can provide (figure out) to (for) you (but maybe not, lol).
You're familiar with the basics of the GUI (the noob-friendly mode with the buttons, menus, windows, etc), right?
(if not, I can explain more of what I'm saying)
(do not type in my use of the single quotes, '...', as I'm just using them to highlight what you type into the GUI's stuff)
Functions -> Add -> 'TakingRocks' -> Script ->
Add New Script -> Output (Print A Message) -> 'How many rocks do you take?'
Add New Script -> Output (Get Input), then run script:
->Variables (Set A Variable Or Attribute) -> Set Variable 'player.rockquantity' = [expression] 'result'
Object -> Player -> Attributes (Tab) -> Attributes (bottom big box) -> Add -> 'rockquantity' -> [integer] -> '0'
Object -> Player -> Attributes (Tab) -> Status Attributes (top smaller box) -> Add -> 'rockquantity' -> '_____' (leave blank)
then it's just a matter of where-how you want to get the rocks from-by
for just this general example, I'll put this as a starting script:
Object -> Game -> Script -> Starting Script ->
Add New Script -> Scripts (Call Function) -> Call Function 'TakingRocks' with parameters -> Add (leave blank, don't add any!)
----------------
this is just coding for taking rocks, if you want more general coding, you're going to need to get help from someone else, as general coding is beyong my limited noob knowledge of coding, at the moment (and probably for quite awhile too), lol.
---------------
Edit:
I just realized, using (setting up) a command (if I'm addressing correctly what you're asking for) would be better for what you want, which I think I can provide (figure out) to (for) you (but maybe not, lol).

Pertex
03 Jan 2013, 09:08You can use the ToInt function http://quest5.net/wiki/ToInt