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 06-02-2007, 09:03 AM
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
Objects. Love/Hate Relationship.

While enjoying my ability to come up with quirky names for threads. I'm having an issue elsewhere with me objects in my mudlib.

Here's the issue:

When I echo all the objects vars through the for loop. It only returns the values/information of the last two vars. This is causing a serious pain in the ass. Becuse no matter what I come up with. It refuses to return the values for all 3 object variables.

However, I know the variables are being written as getDynamicVarNames() returns all three vars. But I'm only getting the values for two.

Here's the script portion:

PHP Code:
public function reflectItems() {
  list = (
"Control_Mudlib").itemreflectvars;
  array.
clear();
  
  for (
05i++) {
    if (
files[i] == null) {
      break;
    }
    
    
item = new TStaticVar();
    
item.loadVars("mud/" files[i] @ ".arc");
    
    
obj = new TStaticVar();
    
obj.(@ list[i]) = makevar("item." @ list[i]);
        
    for (var : 
obj.getDynamicVarNames()) {
      echo(
obj.(@ var));
    }
  }

__________________


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
  #2  
Old 06-02-2007, 09:41 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Where is 'files' coming from?
Reply With Quote
  #3  
Old 06-02-2007, 10:02 AM
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
files is an array list of item names I set in an earlier function.
__________________


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 06-02-2007, 11:05 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
files - locations of lists...
lists - variables of concern...

What I see is this:

a) lists[ i ] is with respect to files[ i ] here... What you'd have to do is just:
PHP Code:
 for ( temp.var: list )
  
obj.(@ temp.var ) = item.(@ temp.var ); 
b) Variables might be reserved.
Reply With Quote
  #5  
Old 06-02-2007, 11:29 AM
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
Thanks Novo! Worked like a charm.
__________________


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
  #6  
Old 06-02-2007, 04:19 PM
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
Quote:
Originally Posted by killerogue View Post
<stuff>
You look glad I released my scripts I can tell thats based on stuff I made.

You know, you don't have to initialize all objects to TStaticVar (but its good insurance), TGraalVar is variable after all.

Observe:
PHP Code:
public function saveItems() {
  
temp.file 0;
  
temp.0;
  
temp.path 0;
  
temp.data 0;
  
  
  for (
this.items.size() - 1> -1--) {
    if (
this.items[i].archname != null) {
      
data this.items[i].getSaveData();
      
file.(@ "item" data[0]) = {data[1], data[2], data[3]};
    }
  }
  
path MudControl.containerpath this.conttype "/cont" this.contid ".txt";
  
file.saveVars(path0);

file is not TStaticVar :P
__________________
Reply With Quote
  #7  
Old 06-02-2007, 04:33 PM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
Quote:
Originally Posted by Inverness View Post
PHP Code:
  path MudControl.containerpath this.conttype "/cont" this.contid ".txt"
Umm... Shouldn't variables be MudControl.(@ containerpath @ this... ) instead?

I thought variables concatenations don't work that way.
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 09:58 PM.


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