Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #16  
Old 08-17-2010, 06:29 PM
Liberated Liberated is offline
not doing alot
Liberated's Avatar
Join Date: Feb 2008
Posts: 1,366
Liberated has a spectacular aura about
Quote:
Originally Posted by Loriel View Post
okay so since I am paying him too i am paying him not to change float() or add a new function or whatever
Thats not what i ment,
Stefan is earning money with graal, we are paying him to play, and develop on it. Something is not working as expected,
they ask for a change, it is their right to ask stefan to change it for them, and not spend both their time own time on it.
You were asking why stefan had to do all the programming, not why he should or should not change float().
__________________
Quote:
Originally Posted by Tigairius View Post
I promise when I get rich I'll send you an iPhone. I'll send everyone an iPhone.
Reply With Quote
  #17  
Old 08-17-2010, 06:32 PM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
We don't pay anyone. We rent their service to continue their work. We're more or so donaters, not tax payers so why should Stefan be expected to make anything more than he has to other than player satisfaction?
__________________

Careful, thoughts and opinions here scare people.
Reply With Quote
  #18  
Old 08-17-2010, 06:41 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Loriel View Post
Why the hell does Stefan have to do all the programming for you infants

stefan can you add a function to tie my shoelaces :'(
QQ some more please, you can do it!
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #19  
Old 08-17-2010, 07:04 PM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
For what it's worth, I've never used a float() function that didn't convert "123str" into 123. That's kind of the purpose, isn't it?
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #20  
Old 08-17-2010, 07:05 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by xXziroXx View Post
Definitely. Just because a string STARTS with numbers doesn't mean it's a number.
This is intentional since it allows extra notation to be correctly parsed:
PHP Code:
echo(float("1.0e4")); // 10000
echo(float("0xBC"));  // 188 
GScript is behaving in this case completely as expected, and this is the same as in JavaScript and a lot of other dynamically/variantly typed languages, so no, it can't be changed without breaking it's intended functionality.

If this is a problem then you should validate your input before processing.
__________________
Skyld
Reply With Quote
  #21  
Old 08-17-2010, 08:12 PM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Call me stupid but what are some actual purpose of using float( "123str");
Reply With Quote
  #22  
Old 08-17-2010, 08:18 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by MrOmega View Post
Call me stupid but what are some actual purpose of using float( "123str");
Let's assume we have user input. We want a number. The user gives us a string instead of a number. Ideally, throwing it into the float()-bin will return -1 and tell us it's a string this way. When there are numbers at the beginning, it won't. Don't see an issue though. Of course, this is just an example. Might be a problem elsewhere. But that can be worked around.
Reply With Quote
  #23  
Old 08-17-2010, 08:36 PM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
Quote:
Originally Posted by Crow View Post
Ideally, throwing it into the float()-bin will return -1 and tell us it's a string this way.
Let's make sure to mention that, in this scenario, a custom sanitation function would be best, as Skyld said.
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #24  
Old 08-17-2010, 08:41 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Skyld is my hero.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #25  
Old 08-17-2010, 08:50 PM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Quote:
Originally Posted by Skyld View Post
This is intentional since it allows extra notation to be correctly parsed:
PHP Code:
echo(float("1.0e4")); // 10000
echo(float("0xBC"));  // 188 
It's not like it'd be impossible to make a parser which only accepts those variants when a letter is encountered.

I also don't think it matters that this is "how it usually works" in dynamically-typed languages, since a lot of other languages do dumb things.


But the important fact is that this behavior already exists and bugs may be introduced if it is changed.
Reply With Quote
  #26  
Old 08-17-2010, 10:09 PM
Riot Riot is offline
Delteria Management
Join Date: Nov 2003
Location: Seminole County, Florida
Posts: 280
Riot is on a distinguished road
In my opinion, the fact that float returns -1 on error makes less sense then "123str" returning 123.
Reply With Quote
  #27  
Old 08-17-2010, 10:13 PM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Quote:
Originally Posted by Riot View Post
In my opinion, the fact that float returns -1 on error makes less sense then "123str" returning 123.
GS2 doesn't have any error handling or NaN/undefined. I suppose 0 would be a softer fail.

Edit: Post 666

Last edited by WhiteDragon; 08-18-2010 at 02:36 AM..
Reply With Quote
  #28  
Old 08-17-2010, 10:59 PM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
Quote:
Originally Posted by Riot View Post
In my opinion, the fact that float returns -1 on error makes less sense then "123str" returning 123.
What doesn't make sense about float('123str') returning 123? Just look at it semantically: float() does not imply a function that checks if there are non-mathematical characters. It implies returning a float value.
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #29  
Old 08-18-2010, 12:48 AM
Riot Riot is offline
Delteria Management
Join Date: Nov 2003
Location: Seminole County, Florida
Posts: 280
Riot is on a distinguished road
Quote:
Originally Posted by LoneAngelIbesu View Post
What doesn't make sense about float('123str') returning 123? Just look at it semantically: float() does not imply a function that checks if there are non-mathematical characters. It implies returning a float value.
I'm not saying it doesn't make sense, just that returning -1 (a perfectly valid value) on error makes less sense.

Last edited by Riot; 08-18-2010 at 12:58 AM.. Reason: Reworded..
Reply With Quote
  #30  
Old 08-18-2010, 01:48 AM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by WhiteDragon View Post
GS2 doesn't have any error handling or NaN/undefined. I suppose 0 would be a softer fail.
Yeah that is the explanation but guy still has a point
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:55 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.