Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Class Calling Problem (https://forums.graalonline.com/forums/showthread.php?t=73440)

godofwarares 04-12-2007 02:47 AM

Class Calling Problem
 
Hey.

I'm trying to make a script that holds an array of class names, and i'm trying to call it like this:

PHP Code:

this.classes = {"control"}

for (
temp.curClassthis.classes)
{
     
this.join(temp.curClass);
     (@ 
temp.curClass)::start();


It simply doesn't work, because I get this error:

Quote:

Originally Posted by RC
error: missing semicolon at line 6: (@ temp.curClass)::start();
error: unexpected token: :: at line 6: (@ temp.curClass)::start();

I've had this problem before. Is there any way to call a class through this method?

I appreciate it in advance.

-Hikaru

Rapidwolve 04-12-2007 03:15 AM

Would 'this.start()' work? Since its already joined

JkWhoSaysNi 04-12-2007 03:40 AM

Unless you *need* them joined to the NPC you could do something along the lines of:

PHP Code:

this.classes = {"control"}

for (
temp.curClassthis.classes)
{
     
this.(@ temp.curClass) = new TStaticVar();
     
with (this.(@ temp.curClass)) {      
      
join(temp.curClass);
      
start();
     } 



godofwarares 04-12-2007 03:45 AM

Quote:

Originally Posted by JkWhoSaysNi (Post 1299282)
Unless you *need* them joined to the NPC you could do something along the lines of:

PHP Code:

this.classes = {"control"}

for (
temp.curClassthis.classes)
{
     
this.(@ temp.curClass) = new TStaticVar();
     
with (this.(@ temp.curClass)) {      
      
join(temp.curClass);
      
start();
     } 



Thank you, That works (with a little editing).

xXziroXx 04-12-2007 02:21 PM

Am I the only one that see that you have no semicolon after:

PHP Code:

this.classes = {"control"

Should be..

PHP Code:

this.classes = {"control"}; 


godofwarares 04-12-2007 02:57 PM

Quote:

Originally Posted by xXziroXx (Post 1299370)
Am I the only one that see that you have no semicolon after:

PHP Code:

this.classes = {"control"

Should be..

PHP Code:

this.classes = {"control"}; 


Relax. Typo. :whatever:


All times are GMT +2. The time now is 05:45 AM.

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