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
  #1  
Old 03-05-2007, 11:21 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
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.
__________________
Deep into the Darkness peering...

Last edited by Angel_Light; 03-05-2007 at 11:55 PM..
Reply With Quote
  #2  
Old 03-05-2007, 11:57 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
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.
__________________
Skyld
Reply With Quote
  #3  
Old 03-06-2007, 12:05 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
You can also use float(str). If you put a null string in there, it'll show up as 0.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #4  
Old 03-06-2007, 12:07 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Angel_Light View Post
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); 
__________________
Reply With Quote
  #5  
Old 03-06-2007, 12:25 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
thanks guys, still want it to show 0 without anything extra, oh well... maybe in GS3 lol :o
__________________
Deep into the Darkness peering...
Reply With Quote
  #6  
Old 03-06-2007, 09:36 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by Angel_Light View Post
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)); 
__________________
Do it with a DON!
Reply With Quote
  #7  
Old 03-06-2007, 09:40 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
Or even perhaps:
PHP Code:
Master_Gui_Text.setText(int(currentexp)); 
__________________
Skyld
Reply With Quote
  #8  
Old 03-06-2007, 09:46 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by Skyld View Post
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).
__________________
Do it with a DON!
Reply With Quote
  #9  
Old 03-06-2007, 10:55 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
yes it includes decimals by increments of 0.2
__________________
Deep into the Darkness peering...
Reply With Quote
  #10  
Old 03-07-2007, 12:14 AM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
if varname = 0 just use @varname...
__________________
Reply With Quote
  #11  
Old 03-07-2007, 10:59 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Then
PHP Code:
Master_Gui_Text.text float(clientr.mud.stats.curexp); 
Reply With Quote
  #12  
Old 03-07-2007, 11:05 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Stefan View Post
Then
PHP Code:
Master_Gui_Text.text float(clientr.mud.stats.curexp); 
I knew it .
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
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 07:05 PM.


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