Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-23-2007, 10:19 PM
godofwarares godofwarares is offline
Webmaster
godofwarares's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 552
godofwarares is on a distinguished road
Send a message via ICQ to godofwarares Send a message via AIM to godofwarares Send a message via MSN to godofwarares Send a message via Yahoo to godofwarares
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?
__________________
What signature? I see no signature?
Reply With Quote
  #2  
Old 02-23-2007, 11:42 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Ugh, I cant even read the code thanks to the styling..
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #3  
Old 02-23-2007, 11:43 PM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Quote:
Originally Posted by xXziroXx View Post
Ugh, I cant even read the code thanks to the styling..
Thank you, Ziro. That was extremely helpful.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #4  
Old 02-23-2007, 11:46 PM
godofwarares godofwarares is offline
Webmaster
godofwarares's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 552
godofwarares is on a distinguished road
Send a message via ICQ to godofwarares Send a message via AIM to godofwarares Send a message via MSN to godofwarares Send a message via Yahoo to godofwarares
Quote:
Originally Posted by xXziroXx View Post
Ugh, I cant even read the code thanks to the styling..
How can you not read it?!

__________________
What signature? I see no signature?
Reply With Quote
  #5  
Old 02-23-2007, 11:53 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by godofwarares View Post
How can you not read it?!

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
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #6  
Old 02-24-2007, 12:36 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
ha mine is really different, no one else I know likes it but makes scripting and script reading easier for me. XP
__________________
Deep into the Darkness peering...
Reply With Quote
  #7  
Old 02-24-2007, 02:54 AM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
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? : (
__________________

Last edited by Kristi; 02-24-2007 at 05:04 AM..
Reply With Quote
Reply


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 03:19 PM.


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