Questions with input

Started by James (Aka: The Geek), Thu 23/02/2006 13:54:36

Previous topic - Next topic

James (Aka: The Geek)

ok i have a questions

is there any way i can let the player type any number and it be stored as an int(And can i use decimal)


i have an older version of ags (i got it in october) and i cannot upgrade
"I reject you reality and substitute my own"     -Adam Savage

"When 900 years old you reach look as good you will not"     -Yoda

"LLAP!"     -James

Ashen

Exactly what version are you using? (Click 'Help' --> 'About' if you're not sure.)

You should have the StringToInt(..) function (it's in 2.62 which is probably the earliest you'll have) which would help with the first part, e.g..:
Code: ags

string temp;
int myint;
InputBox("Enter a number:", temp);
myint = StringToInt(temp);


You might have the float type (V2.7+ which I think it's more likely you'll have), which would allow you to use decimals. Otherwise, there's probably a way to work around it, depending on what you need them for.

What do you mean by you "can't upgrade" - is it just that you're already quite far along and don't want to, or have you actually had problems trying?
I know what you're thinking ... Don't think that.

James (Aka: The Geek)

#2
I tried stringtoint But I cant figure out how it works could you explain it?

I can't upgrade because I don't have internet my friend put ags onto a disk for me (I can't ask him to do that again)and right now I am at school.
"I reject you reality and substitute my own"     -Adam Savage

"When 900 years old you reach look as good you will not"     -Yoda

"LLAP!"     -James

Ashen

Well, without knowing exactly what you're trying to do, I can't really be more specific than the example in my last post. Basically, you let the player input a number (I used the InputBox commands, but you could use a TextBox GUI object) which you temporarily store as a string, and then convert it with StringToInt(..). Depending on what version you have (can't remember off the top of my head when 2.71 was released), you might have to use String.AsInt instead. Check the manual entry for more details.
I know what you're thinking ... Don't think that.

James (Aka: The Geek)

I will try it when I get home (I am also giong to see what version I have) ;D

Thank you for all the help Ashen :)

(by the way it is because I want to try to make a verry simple calculator.)

May the force be with you,always. ;)
"I reject you reality and substitute my own"     -Adam Savage

"When 900 years old you reach look as good you will not"     -Yoda

"LLAP!"     -James

Ashen

In that case, you might want to check out SSH's Keypad Combination Lock Module (or my Hotspot based version if you've not got V2.71). Obviously not a calculator, but it might help you with setting up the input side of things, give you a few ideas.
I know what you're thinking ... Don't think that.

James (Aka: The Geek)

#6
O.K. I went home and checked to see what version I have and it turns out my friend just made a copy of the version he already had :o

version 2.56 :'(

so any tips for using this? ???

(I am going to try to find a way to get the new version but it will probaly take a while)

EDIT: Hey wait I just noticed you said V 2.71 i thout you said 27.1
sorry for the mistake
"I reject you reality and substitute my own"     -Adam Savage

"When 900 years old you reach look as good you will not"     -Yoda

"LLAP!"     -James

Ashen

Still, I'm not sure how much help any of what I've said will be - I think 2.56 actually predates my using AGS!

A while back, someone was offering to ship CDs with AGS and some selected games, if you searched for that (and they're still willing) maybe you could get a newer version that way? It's possibly a long shot, and a bit of a hassle, but if there's no other way for you  to get a newer version, it might be worth it.
I know what you're thinking ... Don't think that.

James (Aka: The Geek)

OK I tried using string to int the way you said and it works thank you!
"I reject you reality and substitute my own"     -Adam Savage

"When 900 years old you reach look as good you will not"     -Yoda

"LLAP!"     -James

SMF spam blocked by CleanTalk