Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   BUG? float var within TStaticVar obj (https://forums.graalonline.com/forums/showthread.php?t=134269192)

JohnnyChimpo 05-04-2014 09:08 PM

BUG? float var within TStaticVar obj
 
I have been playing around with TStaticVar objects and one thing i noticed was assigning a float to a variable and trying to echo the var makes the NPC server crash.

NPC Code:
 
obj = new TStaticVar("obj");
obj.name1 = "steve";
obj.number = 123;
obj.float1 = 1.23;
echo( obj.float1 );


NPC Code:
 
obj = new TStaticVar("obj");
obj.name1 = "steve";
obj.number = 123;
obj.numarray = {1,2,3};



Also assigning arrays to the object makes the NPC server crash.

fowlplay4 05-05-2014 03:00 PM

what if you just use

obj = new TStaticVar();

JohnnyChimpo 05-05-2014 11:20 PM

So with further investigation and suggestion from fp4 I have come to the following conclusion.

You maybe not have the same name for the object as the name in the "constructor".

I havent went through all test cases which i dont think i will explore. This is just a rule of thumb in my book now.

ex: obj = new TStaticVar("obj");

Begs the question, why would this have such a behavior?

fowlplay4 05-06-2014 01:53 AM

I don't know the technical reason, but when you make a GUI object. I.e.

PHP Code:

new GuiControl("control_name") {
  


you can access the control globally via control_name, TStaticVar works similarly.

Also I think it would of worked fine if you used a temp. prefix instead of using a global variable.


All times are GMT +2. The time now is 03:06 PM.

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