Graal Forums

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

godofwarares 02-23-2007 10:19 PM

Problem?
 
I have a problem when it comes to calling classes, I want to use a variable to hold the class name and use the :: operator to call it.

Here is a snippet from my code:

PHP Code:

     for ( temp.0temp.temp.getClasses.size(); temp.a++ )
     {
          
temp.res;
          
          
this.join(temp.getClasses[temp.a]);

          
temp.res battledata::start();
          
          if (!
temp.res)
          {
               return 
false;
          }
     }
     
     return 
true

^ That works, but this doesn't:
PHP Code:

     for ( temp.0temp.temp.getClasses.size(); temp.a++ )
     {
          
temp.res;
          
          
this.join(temp.getClasses[temp.a]);
          
          
temp.res = (@ temp.getClasses[temp.a])::start();
          
          if (!
temp.res)
          {
               return 
false;
          }
     }
     
     return 
true

Any ideas?

xXziroXx 02-23-2007 11:42 PM

Ugh, I cant even read the code thanks to the styling..

killerogue 02-23-2007 11:43 PM

Quote:

Originally Posted by xXziroXx (Post 1281411)
Ugh, I cant even read the code thanks to the styling..

Thank you, Ziro. That was extremely helpful. :whatever:

godofwarares 02-23-2007 11:46 PM

Quote:

Originally Posted by xXziroXx (Post 1281411)
Ugh, I cant even read the code thanks to the styling..

How can you not read it?!

:whatever:

xXziroXx 02-23-2007 11:53 PM

Quote:

Originally Posted by godofwarares (Post 1281415)
How can you not read it?!

:whatever:

I just.. cant. Want to see how different your styling is to mine?

PHP Code:

for (temp.0temp.temp.getClasses.size(); temp.a++) {
  
temp.res;

  
this.join(temp.getClasses[temp.a]);

  
temp.res battledata::start();
          
  if (!
temp.res) return false;
}

return 
true

That how I would have styled it. Now, give me a few seconds and I will TRY to check your script for errors.

Hmm. I'm not quite sure of what you are trying to accomplish, but, perhaps trying this will help?

PHP Code:

for (atemp.getClasses) {
  
temp.res;
          
  
this.join(a);
          
  
temp.res = (@a)::start();
          
  if (!
temp.res) return false;
}
return 
true


Angel_Light 02-24-2007 12:36 AM

ha mine is really different, no one else I know likes it but makes scripting and script reading easier for me. XP

Kristi 02-24-2007 02:54 AM

Assuming that temp.getClasses is correctly assigned (please show us that code), we can only assume that (anything):: just doesnt work. for the sake of testing, try (@"battledata")::start

Tell me if that works or not. If it doesn't, looks like we need a new way to dynamically call a function from a class!

Edit:
I decided to not be lazy and try it, (@"anything")::whatever() will not work.

Esentially what you are doing is giving the same npc multiple start() functions. it would be like doing this.

function hi() {
return 2;
}

function hi() {
return 4;
}

Maybe you should find a better system? : (


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

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