Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   returning objects (https://forums.graalonline.com/forums/showthread.php?t=69078)

projectigi 09-30-2006 07:58 PM

returning objects
 
PHP Code:

//#CLIENTSIDE
function onCreated()
  {
  echo(
"ll3");
  
this.counter 0;
  }
public function 
adminMsgamsg )
  {
  echo(
"ll4");
  
this.amsg amsg.tokenize("\b");
  
this.awindow _createWindowthis.amsg.size() );
  echo(
"l2: " this.awindow.text);
  
this.awindow.visible true;
  
GUIContainer.addControlthis.awindow );
  }
function 
_createWindowalines )
  {
  
this.windowname "AdminMsg_Window_" this.counter;
  
this.alines alines;
  ( @ 
this.windowname ) = new GuiWindowCtrl();
  
with( ( @ this.windowname ) )
    {
    
visible false;
    
profile "GuiBlueWindowProfile";
    
width 300;
    
height thiso.alines 16 25;
    
screenwidth width 2;
    
screenheight height 2;
    
canClose true;
    
onclosequery=true;
    
thiso.catcheventthis"onCloseQuery""onCloseWindow" );
    
canMinimize canResize canMaximize false;
    
text "Admin Message";
    
canMove true;
    }
  
this.counter++;
  echo( 
"l: " this.windowname );
  echo( 
"l1" @ ( @ this.windowname ).text );
  return ( ( @ 
this.windowname ) );
  }
function 
onCloseWindow()
  {
  
player.chat params[0].text;
  } 

it should return the window object but for some reason it doesnt o.o
output:
Quote:

ll3
ll4
l: AdminMsg_Window_0
l1Admin Message
l2:

Chompy 10-05-2006 01:46 PM

well inside
PHP Code:

with( ( @ this.windowname ) )
    { 

you are using an variable that I can't see you have setted :)
thiso.alines, I only see this.alines, well, thats only for the height
and for ----v
PHP Code:

( @ this.windowname ) = new GuiWindowCtrl(); 

you could just use
PHP Code:

this.windowname = new GuiWindowCtrl(); 



and:
PHP Code:

this.awindow _createWindowthis.amsg.size() );
echo(
"l2: " this.awindow.text); 

why do this.awindow.text after?
this.awindow is just "AdminMsg_Window_0"
like text, not like an object

and correct me if I am wrong :p

projectigi 10-05-2006 02:43 PM

[QUOTE=Chompy;1226271]well inside
PHP Code:

with( ( @ this.windowname ) )
    { 

you are using an variable that I can't see you have setted :)
thiso.alines, I only see this.alines, well, thats only for the height
and for ----v
PHP Code:

( @ this.windowname ) = new GuiWindowCtrl(); 

you could just use
PHP Code:

this.windowname = new GuiWindowCtrl(); 



and:
PHP Code:

this.awindow _createWindowthis.amsg.size() );
echo(
"l2: " this.awindow.text); 

why do this.awindow.text after?
this.awindow is just "AdminMsg_Window_0"
like text, not like an object
Quote:

and correct me if I am wrong :p
k i will

first
Quote:

PHP Code:

with( ( @ this.windowname ) )
    { 

you are using an variable that I can't see you have setted :)
thiso.alines, I only see this.alines, well, thats only for the height
if you would use this.alines within a with it would refer to the object thats it in now, that would be e.g. AdminMsg_Window_0.alines
but thiso is for global access afaik you can use thiso.alines after you have set this.alines

Quote:

PHP Code:

( @ this.windowname ) = new GuiWindowCtrl(); 

you could just use
PHP Code:

this.windowname = new GuiWindowCtrl(); 


this would set this.windowname to the newly created GuiWindowCtrl
but e.g.
this.windowname = "bleh";
this.( @ windowname ) = new GuiWindowCtrl();
wouldt set the variable this.bleh to a new GuiWindowCtrl

:P well i fixed some things and now it works lol

Chompy 10-05-2006 02:47 PM

^^


All times are GMT +2. The time now is 08:23 AM.

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