Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-04-2014, 09:08 PM
JohnnyChimpo JohnnyChimpo is offline
Registered User
JohnnyChimpo's Avatar
Join Date: Jun 2004
Posts: 105
JohnnyChimpo is on a distinguished road
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.
Reply With Quote
  #2  
Old 05-05-2014, 03:00 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
what if you just use

obj = new TStaticVar();
__________________
Quote:
Reply With Quote
  #3  
Old 05-05-2014, 11:20 PM
JohnnyChimpo JohnnyChimpo is offline
Registered User
JohnnyChimpo's Avatar
Join Date: Jun 2004
Posts: 105
JohnnyChimpo is on a distinguished road
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?
Reply With Quote
  #4  
Old 05-06-2014, 01:53 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
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.
__________________
Quote:
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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:47 PM.


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