Graal Forums  

Go Back   Graal Forums > Development Forums > Tech Support
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-30-2006, 12:35 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
More Missing Values

PHP Code:
function onCreated()
  {
  
temp.var = new TStaticVar();
  
temp.var."0";
  
temp.var.savevars"levels/...");
  
  
temp.newvar loadvars"levels/..." );
  echo( 
temp.newvar.getvarnames() );
  } 
PHP Code:
initialized,joinedclasses,name,scriptlogmissingfunctions,timeout 
Where did my Variable 't' go?!

It seems as though the string "0" becomes the integar 0 in the process, and when loaded, it is set to false, removing the variable completely.

Couldn't we claim that considering that it was saved in the savevar that it has no choice but to be a string? ( due to the fact that if it was not a string, it wouldn't have been saved in the first place )
Reply With Quote
  #2  
Old 10-30-2006, 12:49 AM
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
Will temp.newvar.t not == 0 anyway, since it is an "uncreated" variable?
Reply With Quote
  #3  
Old 10-30-2006, 02:21 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
Quote:
Originally Posted by Skyld View Post
Will temp.newvar.t not == 0 anyway, since it is an "uncreated" variable?
Yes, however, there is a difference when I want... Well, put it in context.

I want to make a system in which options are set.

PHP Code:
setting.hasStaffBoots=true 
However, if I want to remove it, I want to apply another file to an account...

PHP Code:
setting.hasStaffBoots=false 
The way to know on such ambiguous terms is through

PHP Code:
for ( itemp.var.setting.getdynamicvarnames() )
  
player.setting.(@ ) = temp.var.setting.(@ ); 
Because the variable is equal to false, it vanishes completely!
By cause, however, when I do the getdynamicvarnames(), it doesn't interpret the hasStaffBoots=false, and therefore, it doesn't set it to player.setting.(@ i )... Thereby, the old value remains true: the player.setting.(@ i ) doesn't get changed because the hasStaffBoots isn't part of the variable anymore.

Ultimately, there IS a difference, even though the shorthand of setting.hasStaffBoots is still equal to 0.
Reply With Quote
  #4  
Old 10-30-2006, 02:26 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
Err... I made an error in my debugging... It's further on in the script that it gets removed... :: continues research ::

Alright -- The error occurs in savevarstoarray( 0 ) – It doesn't save empty vars.

Setting

var.hasStaffBoots=false instead of var.hasStaffBoots=0 has changed the results to the expected ones.
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 05:55 PM.


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