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 08-09-2008, 02:14 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Class joining bug/undocumented feature

This is the code I am executing:

-whitedragon_system
PHP Code:
new TStaticVar("Movement").join("whitedragon_system_movement");
new 
Movement("NormalMovement").join("whitedragon_system_movement_normal");
this.movement = new NormalMovement().construct(); 
whitedragon_system_movement
PHP Code:
public function construct() {
  echo(
"----------");
  echo(
this.joinedclasses);
  echo(
this.getfunctions());
  for(
this.getfunctions())
    echo(
f SPC f.scope);
  echo(
"----------");
  return 
this;

whitedragon_system_movement_normal
PHP Code:
public function construct() {
  echo(
"movement_normal");
  return 
this;

The code that you see in whitedragon_system_movement is some debugging code to see exactly what functions exist and what is getting over written.

I get the following output:
PHP Code:
----------
whitedragon_system_movement,"",whitedragon_system_movement_normal
loadstring
,geteditvarnames,insertarray,subarray2,addnamedstring,savexmltostring,ignoreevents,loadvarsfromarray,loadini,getdynamicvarnames,savevars,sortdescending,loadvars,loadxml,savelines,cancelevents,getfunctions,copyfrom,getstaticvarnames,sortbyvalue,getvarnames,hasfunction,clearemptyvars,timershow,addarray,leave,loadxmlfromstring,scheduleevent,loadlines,objecttype,settimer,savestring,ignoreevent,loadfolder,addarraymember,destroy,savevarstoarray,join,catchevent,sortascending,getarraymember,trigger,isinclass,savexml,clearvars,construct,construct
loadstring 
public
geteditvarnames public
insertarray public
subarray2 public
addnamedstring public
savexmltostring public
ignoreevents public
loadvarsfromarray public
loadini public
getdynamicvarnames public
savevars public
sortdescending public
loadvars public
loadxml public
savelines public
cancelevents public
getfunctions public
copyfrom public
getstaticvarnames public
sortbyvalue public
getvarnames public
hasfunction public
clearemptyvars public
timershow public
addarray public
leave public
loadxmlfromstring public
scheduleevent public
loadlines public
objecttype public
settimer public
savestring public
ignoreevent public
loadfolder public
addarraymember public
destroy public
savevarstoarray public
join public
catchevent public
sortascending public
getarraymember public
trigger public
isinclass public
savexml public
clearvars public
construct public 
That's handful, so I'll sum it up for you:
  • echo(this.getfunctions()) echos "construct" twice.
  • The loop echos "construct" once.
  • It doesn't finish the block of code (there are no ending dashes echoed).


This behavior is getting so weird, I had no idea what was going on.
Even speculation would be helpful.

Thank you.
Reply With Quote
  #2  
Old 08-09-2008, 02:21 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Your object creation syntax is horrible, please do it properly just in the interest of eliminating all possibilities in error.

And having two construct echoed is not surprising.
Its possible to do <classname>::<functionname>(); if two classes have same function.

I would highly suggest avoiding situations where functions overwrite like that.

PHP Code:
function thefunction() {
  
temp.var = new TStaticVar("Movement");
  
temp.var.join("whitedragon_system_movement");
  
temp.var = new Movement("NormalMovement");
  
temp.var.join("whitedragon_system_movement_normal");
  
this.movement = new NormalMovement();
  
this.movement.construct();

__________________
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 07:54 AM.


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