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-05-2007, 10:29 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
Object NOT Loading Vars >_>

First off here's the part of the function in the class:

PHP Code:
function reflectItem(archpresufid)
{
  echo(
"[ItemReflect]");
  
file = new TStaticVar();
  
TObj = new TStaticVar();
  
TObj.id id;
  
TObj.qty this.item.qty
  if (
this.item != NULL) {
    echo(
"Object exists");
    
file.loadVars("mud/archetypes/" arch ".arc"); // Problem found, file is not loading the vars.
      
echo(file.getVarNames());
    echo(
"Loaded vars and removed vars...");
    for(var : 
file.getDynamicVarNames()) {
      
TObj.(@ var) = file.(@ var);
      echo(
"[ItemReflect]:" SPC var @ "=" file.(@ var));
    }
  } 

The problem is, the "file" object is not returning any of the vars it's loading. >_> What the hell is going on here.
__________________


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-05-2007, 10:50 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
You sure like to butcher the scripts I give you. Anyhow, make sure npcserver has rights to the folder. Also, you need to declare your temp variables are the beginning of the script X_X
__________________
Reply With Quote
  #3  
Old 06-05-2007, 10:55 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 Inverness View Post
You sure like to butcher the scripts I give you. Anyhow, make sure npcserver has rights to the folder. Also, you need to declare your temp variables are the beginning of the script X_X
This isn't the one you helped me with, this is something different Chompy and I were working on together.

Edit: Npc server already had rights to the necessary folders and declaring the vars temp prior to fixed nothing. :[

Super Edit: Problem was identified in another class.
__________________


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.

Last edited by killerogue; 06-05-2007 at 11:28 PM..
Reply With Quote
  #4  
Old 06-05-2007, 11:55 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
The 'True' Problem

PHP Code:
public function loadItems()
{
  
temp.data 0;
  
temp.file 0;

  
path format(MudControl.charitems "%s.arc"this.account);
  
file.loadVars(path);
  
  
with (file) {
    
keys getstringkeys("this.item");
    echo(
keys);
  }
    
  for (
0keys.size(); i++) {
    
data.clear();
    
data file.(@ "item" keys[i]);
    echo(
data[0]);
      
loadItem(idata[0], data[3], data[1], data[2]);
  }

Zeroed in on the true problem with the help of Chandler, the vars are being properly send to the function that calls what I first posted. loadItem is that function.

Here's the issue, the data line. When echoing "data" or "data[0]" it returns the entire array where as "data[1] - data[3]" return zero when they shouldn't. >_>


Edit: Didn't Inverness have this same issue with copying arrays? -.-
__________________


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
  #5  
Old 06-06-2007, 04:17 AM
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
You seem to be quite good at editing my scripts and breaking them in the process =P
__________________
Reply With Quote
  #6  
Old 06-06-2007, 04:28 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
Quote:
Originally Posted by Inverness View Post
You seem to be quite good at editing my scripts and breaking them in the process =P
Didn't edit yours! :[
__________________


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
  #7  
Old 06-06-2007, 04:31 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
Quote:
Originally Posted by Inverness View Post
You seem to be quite good at editing my scripts and breaking them in the process =P
Thats how learn how to script, XD Napo gave me your script and I would "play" with them. :P Oh and are you sure your 'lining up" the variables correctly?
__________________
Deep into the Darkness peering...
Reply With Quote
  #8  
Old 06-06-2007, 04:37 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
Ugh, none of that is the problem. The problem is when I'm trying to put the vars in the array. It creates a multidemensional array rather than fill it up.

EXAMPLE:

array 2 = {"crap", "foo", "bar",}
array1.clear();

array1 = array2;

It's returning array 1 like in on of these:

array1 = {array2, array2, array2}

And has array two set as all the indices.

or

Just sets array2 as the first index. But the idea is for:

array 1 = array 2
array1 should end up equalling {"crap", "foo", "bar"}
__________________


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
  #9  
Old 06-06-2007, 01:25 PM
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
Ah, I remember a buddy of mine had this problem he had to put something infront of array2

array1 = something(array2);

Sorry don't remember what, hope that helps any. :/
__________________
Deep into the Darkness peering...
Reply With Quote
  #10  
Old 06-06-2007, 03:20 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Maybe it isn't saving right? If you are using add(), try doing addarray() instead (like if you were using it in the file saving). Does the file you are loading from have quotes in the variables?
__________________
Do it with a DON!
Reply With Quote
  #11  
Old 06-06-2007, 08:31 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
Stop using clear(), its unnecessary
And show me the file you're loading from.
__________________
Reply With Quote
  #12  
Old 06-06-2007, 09:23 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Assigning one array to another is working fine.
When you only get stuff in data[0] or data then it is probably not an array, eventually the item data is not a correct comma-separated list (manually edited?). It must be text,"item name",text instead of text,item name,text
Reply With Quote
  #13  
Old 06-07-2007, 12:26 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by Stefan View Post
Assigning one array to another is working fine.
When you only get stuff in data[0] or data then it is probably not an array, eventually the item data is not a correct comma-separated list (manually edited?). It must be text,"item name",text instead of text,item name,text
Yeah if you have something like this in the file:

varname="text,text,text"

It will give you (in GS2 terms): varname = {{"text", "text", "text"}};
As you can see that is an array inside an array so what you want is:

varname=text,text,text
__________________
Do it with a DON!
Reply With Quote
  #14  
Old 06-07-2007, 03:06 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
Zero and Stefan perfectly fixed my problems. Thanks guys for all your help. Inside the file the var wasn't an array, it was a string. >_>
__________________


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
  #15  
Old 06-07-2007, 09:28 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
No problem
__________________
Do it with a DON!
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:30 PM.


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