Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / val() only returns an integer?

Author
Message
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 28th Aug 2011 15:24 Edited at: 13th Mar 2012 21:44
Consider this...

I'm asking my player to type in an angle for a cannon to shoot.

The angle can be a float value, i.e. 45.3 or 15.0, like that.

GetTextInput() only returns a string.

Val() only returns an integer.

How do I get the float value my player typed in?

Here's what I've come up with.



If anyone can suggest a quicker or easier way to input a float, I would sure appreciate the help!

EDIT: Oops! You may assume that I've modified the above code to account for no decimal point in the player input.

MORE EDIT: Okay, I stripped it down and added a check for no decimal point in the input text. But it still seems like an awful lot of work just to get a float...

and this fixes the change in right() made in the last update to AGK...

MobileCreator
12
Years of Service
User Offline
Joined: 1st Jun 2011
Location: Ottawa - Canada
Posted: 29th Aug 2011 21:47
I think this should be considered a BUG. I'd assume val() returns a number, integer or float.

In DBPro, this works:

float#=val(string$)

AGK should do the same, imho.

Cheers

----------
Paulo
http://www.mobilecreators.com

Login to post a reply

Server time is: 2024-04-16 07:48:30
Your offset time is: 2024-04-16 07:48:30