Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   0 is a no show. (https://forums.graalonline.com/forums/showthread.php?t=72619)

Angel_Light 03-05-2007 11:21 PM

0 is a no show.
 
I cant get a single digit0 to display in my gui, it's a mud var I'm using,
PHP Code:

  this.clientr.mud.stats.curexp 0

I know 0 is null but why doesnt the gui still show 0?

EDIT :
Think I found a solution :
PHP Code:

 if (clientr.mud.stats.curexp == NULMaster_Gui_Text_Exp.setText("EXP : 0/ " clientr.mud.stats.maxexp); 

Still want 0 to show by itself.

Skyld 03-05-2007 11:57 PM

In GScript2, 0 (NULL) is technically the variable not existing. When you set something to 0, it becomes unset, and unset variables automatically read 0.

it's the way the new engine works.

napo_p2p 03-06-2007 12:05 AM

You can also use float(str). If you put a null string in there, it'll show up as 0.

Chompy 03-06-2007 12:07 AM

Quote:

Originally Posted by Angel_Light (Post 1285195)
I cant get a single digit0 to display in my gui, it's a mud var I'm using,
PHP Code:

  this.clientr.mud.stats.curexp 0

I know 0 is null but why doesnt the gui still show 0?

EDIT :
Think I found a solution :
PHP Code:

 if (clientr.mud.stats.curexp == NULMaster_Gui_Text_Exp.setText("EXP : 0/ " clientr.mud.stats.maxexp); 

Still want 0 to show by itself.

PHP Code:

Master_Gui_Text_Exp.setText("EXP : " @ (currentexp ?  currentexp "0") @ " / " clientr.mud.stats.maxexp); 


Angel_Light 03-06-2007 12:25 AM

thanks guys, still want it to show 0 without anything extra, oh well... maybe in GS3 lol :o

zokemon 03-06-2007 09:36 PM

Quote:

Originally Posted by Angel_Light (Post 1285232)
thanks guys, still want it to show 0 without anything extra, oh well... maybe in GS3 lol :o

PHP Code:

Master_Gui_Text_Exp.setText(max(0currentexp)); 


Skyld 03-06-2007 09:40 PM

Or even perhaps:
PHP Code:

Master_Gui_Text.setText(int(currentexp)); 


zokemon 03-06-2007 09:46 PM

Quote:

Originally Posted by Skyld (Post 1285595)
Or even perhaps:
PHP Code:

Master_Gui_Text.setText(int(currentexp)); 


If you wanted a integer, yes. But his exp may (though I doubt it) include decimals.

I still like max() though. One of my favorite functions for math related things :)
I always see people doing all these integrated equations (the whole # > # ? # : # method) when they could simply use a combination of min(), max(), abs(), int() and the % symbol (not every case, obviously).

Angel_Light 03-06-2007 10:55 PM

yes it includes decimals by increments of 0.2

Kristi 03-07-2007 12:14 AM

if varname = 0 just use @varname...

Admins 03-07-2007 10:59 AM

Then
PHP Code:

Master_Gui_Text.text float(clientr.mud.stats.curexp); 


napo_p2p 03-07-2007 11:05 AM

Quote:

Originally Posted by Stefan (Post 1285853)
Then
PHP Code:

Master_Gui_Text.text float(clientr.mud.stats.curexp); 


I knew it ;).


All times are GMT +2. The time now is 10:38 AM.

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