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 04-07-2007, 09:15 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
Array Copying Problems

READ MY POST BEFORE YOU MAKE YOURSELF LOOK STUPID

Ok, heres a little script thats part of the new mud system I'm working on.
PHP Code:
public function loadObject() {
  
temp.file 0;
  
temp.vars 0;
  
temp.0;
  
temp.0;
  
temp.0;
  
  
file = new TStaticVar();
  
file.loadvars(format("%s/%s/%s.txt"MudControl.mudpaththis.mudtypethis.mudid));
  
MudControl.loadRefs(file);
  echo(
"1:" file.muditems[0].mudid);
  echo(
"2:" file.muditems[1].mudid);
  
vars file.getVarNames();
  
vars.remove("mudid");
  
vars.remove("mudtype");
  
  for (
0vars.size(); ++) {
    
//if (file.(@ vars[i]).type() != 3) {
      
this.(@ vars[i]) = file.(@ vars[i]);
    
//}
    //else {
    //  s = file.(@ vars[i]).size();
    //  this.(@ vars[i]) = new [s];
    //  for (e = 0; e < s; e ++) {
    //    this.(@ vars[i])[e] = file.(@ vars[i])[e];
    //  }
    //}
  
}
  echo(
"3: " this.muditems[0].mudid);
  echo(
"4: " this.muditems[1].mudid);
  
file.destroy();
  
triggerAll("onLoadedObject"null);

Now heres my problem, when an object is loaded it contains reference strings like ref:item:20010 and ref:item:20011 which were the two objects I was using for this test. Now the MudControl parses all these strings and returns the correct MudObject# for them.

This works all find and dandy because in echos 1 and 2 it correctly displays the MudID under all conditions, meaning the reference parser is fine. Now my problem was that echos 3 and 4 were blank even though I was simply copying an already existing reference array.

Now previously in the object is another variable, the reference to the archetype which is just a single reference and not an array, this was copied to the current object just fine in all cases. Now when I tried to copy the array of the two items as a whole, it didn't work for some reason and echos 3 and 4 were blank as I said. Now then, what I did was add in the lines that you see commented out and the script worked fine after that.

Is this a bug or something?
__________________

Last edited by Inverness; 04-07-2007 at 10:48 PM..
Reply With Quote
  #2  
Old 04-07-2007, 09:37 PM
contiga contiga is offline
Graal2001 Administration
contiga's Avatar
Join Date: Jul 2004
Location: Netherlands
Posts: 419
contiga is an unknown quantity at this point
Send a message via ICQ to contiga Send a message via AIM to contiga Send a message via MSN to contiga Send a message via Yahoo to contiga
PHP Code:
vars file.getDynamicVarNames(); 
__________________
AIM: Contiga122
MSN: [email protected]
Status:
Quote:
Originally Posted by unixmad View Post
I am also awake 3AM to help correct problems.
Quote:
Originally Posted by Bomy Island RC people
Daniel: HoudiniMan is a bad guy =p
*Bell: rofl. I first read that as houdini is a bad man. like the little kid that wants his mommy to keep her away from that boogie man
Daniel: xD
*Rufus: I wouldn't want my kids around him.
Reply With Quote
  #3  
Old 04-07-2007, 09:57 PM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Quote:
Originally Posted by contiga View Post
PHP Code:
vars file.getDynamicVarNames(); 
I was going to say that but I didn't think it was what he needed o_o
Reply With Quote
  #4  
Old 04-07-2007, 10:00 PM
contiga contiga is offline
Graal2001 Administration
contiga's Avatar
Join Date: Jul 2004
Location: Netherlands
Posts: 419
contiga is an unknown quantity at this point
Send a message via ICQ to contiga Send a message via AIM to contiga Send a message via MSN to contiga Send a message via Yahoo to contiga
Quote:
Originally Posted by Rapidwolve View Post
I was going to say that but I didn't think it was what he needed o_o
Well I looked further in the script lol,, and I think that was what he was needing when I looked at this part:
PHP Code:
  for (0vars.size(); ++) {
    
//if (file.(@ vars[i]).type() != 3) {
      
this.(@ vars[i]) = file.(@ vars[i]);... blabla 
What he could also do tho is:
PHP Code:
for ( ivars)
  
this.( @ i) = file.( @ i); 
Way shorter and more "clean" looking.
__________________
AIM: Contiga122
MSN: [email protected]
Status:
Quote:
Originally Posted by unixmad View Post
I am also awake 3AM to help correct problems.
Quote:
Originally Posted by Bomy Island RC people
Daniel: HoudiniMan is a bad guy =p
*Bell: rofl. I first read that as houdini is a bad man. like the little kid that wants his mommy to keep her away from that boogie man
Daniel: xD
*Rufus: I wouldn't want my kids around him.
Reply With Quote
  #5  
Old 04-07-2007, 10: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
God damnit
You people need to read what I wrote in the freaking post. The script works fine already. Stop trying to correct stuff thats not broken.
Quote:
Originally Posted by Chompy
And, you can't send objects(/raw info) as params
You damn well can, object's locations don't change only references to them. The script already works like that, god.

Now here is the problem:
PHP Code:
---------
object1.var = {object3object4};
object2.var = object1.var;
//Objects are lost
---------
object1.var = {object3object4};
object2.var = new [object1.var.size()];
object2.var[0] = object1.var[0];
object2.var[1] = object1.var[1];
//Objects are saved 
__________________
Reply With Quote
  #6  
Old 04-07-2007, 10:35 PM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Quote:
Originally Posted by Inverness View Post
God damnit
You people need to read what I wrote in the freaking post. The script works fine already. Stop trying to correct stuff thats not broken.

You damn well can, object's locations don't change only references to them. The script already works like that, god.
What the hell?
Reply With Quote
  #7  
Old 04-07-2007, 10:39 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
I edited my example to be more accurate.
Edit:
I never got the for(var: var) thing down.
So if I did for(i: vars) then would i represent vars[index]?
__________________
Reply With Quote
  #8  
Old 04-07-2007, 11:04 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Make sure you're getting the var names
PHP Code:
 echo("Vars Found:" SPC getstringkeys("this.mud")); 
I was also thinking about the DynamicVars function.


Also, why do people use files for their mudlibs!
DON'T DO IT, IT ISN'T NECESSARY. :[
Reply With Quote
  #9  
Old 04-07-2007, 11:06 PM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Quote:
Originally Posted by Inverness View Post
I edited my example to be more accurate.
Edit:
I never got the for(var: var) thing down.
So if I did for(i: vars) then would i represent vars[index]?
Yes

for (i: vars)
newobj = i;

is equivilant to

for (i = 0; i < vars; i++)
newobj = vars[i];
Reply With Quote
  #10  
Old 04-07-2007, 11:08 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 Rapidwolve View Post
<text>
Ah thanks, no wonder it never worked for me. I don't think that was clearly explained when GS2 was introduced, or maybe I just live under a rock
__________________
Reply With Quote
  #11  
Old 04-07-2007, 11:59 PM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Quote:
Originally Posted by Chandler View Post
Make sure you're getting the var names
PHP Code:
 echo("Vars Found:" SPC getstringkeys("this.mud")); 
I was also thinking about the DynamicVars function.


Also, why do people use files for their mudlibs!
DON'T DO IT, IT ISN'T NECESSARY. :[
It's like an assurance that if something happens the text file will still be there. Say some idiot resets your ItemLib npc, what do you do then o_o
Reply With Quote
  #12  
Old 04-08-2007, 12:01 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
If you type the items in the script and then compile the script, even if flags are reset you can just recompile the script.
__________________
Reply With Quote
  #13  
Old 04-08-2007, 12:05 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
Quote:
Originally Posted by Chandler View Post
Make sure you're getting the var names
PHP Code:
 echo("Vars Found:" SPC getstringkeys("this.mud")); 
I was also thinking about the DynamicVars function.


Also, why do people use files for their mudlibs!
DON'T DO IT, IT ISN'T NECESSARY. :[
What the hell? ARE YOU EVEN READING WHAT I POSTED

And I use files because objects will be SAVED TO FILE when they're not in use. Like when you logoff. My system is designed as an object-controller, current types are (arch, ench, char, plyr, item, cont) for Archetype, Enchantment, (npc) Character, Player, Item, and Container. The files must be saved when they're not in use.

script from mudobject Class
PHP Code:
public function destroyObject() {
  
triggerAll("onDestroyObject"null);
  echo(
"Destroyed MudObject: " this.mudid);
  
MudControl.allobjects.delete(MudControl.allobjects.index(this));
  
destroy();

script from mudint_saveable Class
PHP Code:
public function saveObject() {
  
temp.file 0;
  
temp.vars 0;
  
temp.0;
  
  
file = new TStaticVar();
  
vars this.getMudVars(truetrue);
  
//echo("SaveVars: " @ vars);
  
for (0vars.size(); ++) {
    
file.(@ vars[i]) = this.(@ vars[i]);
  }
  
MudControl.saveRefs(filethis);
  
file.savevars(format("%s/%s/%s.txt"MudControl.mudpaththis.mudtypethis.mudid), 0);
  
  
triggerAll("onSavedObject"null);
  echo(
"Saved Object: " this.mudid);
  
file.destroy();
}
public function 
onDestroyObject_mudint_saveable() {
  
saveObject();

Notice how when an object is (properly) destroyed, it is automatically saved if the object has the Saveable interface.
__________________
Reply With Quote
  #14  
Old 04-08-2007, 07:44 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by Rapidwolve View Post
It's like an assurance that if something happens the text file will still be there. Say some idiot resets your ItemLib npc, what do you do then o_o
Don't give that idiot the rights to do such a thing? lol

Also, you can easily program the database to store the items, example.
HTML Code:
function onCreated()
  {
  for (temp.currentItem: getstringkeys("this.item"))
    unset("this.item"@ temp.currentItem);
  this.item1 = {"bomb", "wbomb.png", "weapon", {weight, volume}, {necessary data, such as damage and radius}};
  }
That's how I'd do an item system, instead of storing all of this information. It seems rather pointless if you ask me.
Reply With Quote
  #15  
Old 04-08-2007, 08:09 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
I don't think you're grasping the fact that my Mud System is for controlling all objects not just items. An item is just one type of object, there are players, npc, and types for the dialog objects, and various other things like organizations.
__________________
Reply With Quote
  #16  
Old 04-08-2007, 10:14 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
Quote:
Originally Posted by Inverness View Post
Now here is the problem:
PHP Code:
---------
object1.var = {object3object4};
object2.var = object1.var;
//Objects are lost
---------
object1.var = {object3object4};
object2.var = new [object1.var.size()];
object2.var[0] = object1.var[0];
object2.var[1] = object1.var[1];
//Objects are saved 
Not true, object2.var = object1.var when object1.var is an array works just fine. It does not get lost. You are making a generalized nonexistant error from your specific problem. Your code faulters somewhere else, not on an array=array assignment.

Your problem is you are treating variables like objects. none of these objects are objects, they are just variable. someobj isnt an object, and someobj.something is just a different var, unless you say someobj = someotherobj, or someobj = new TStaticVar(); thus giving it an object definition.

The reason your properties arent copying over from file.whatever to this.whatever is because the whatevers are NOT objects.

in the above example, if object3 and object4 were specifically declared as objects, object1.var would definately reference objects, then object2.var would definately copy over object one, and it would work. the reason it doesnt work is beacuse object3 and object4 arent actually objects yet, and object3.whatever name is just the name of a variable, not a subvariable of the object.

PHP Code:
objj3.lame "hi";
objj4.lame "ho";
objj1.var = {objj3,objj4};
objj2.var = objj1.var;
echo(
objj1.var[0].lame SPC objj2.var[0].lame);
// This echo outputs nothing

objj3 = new TStaticVar();
objj4 = new TStaticVar();
objj3.lame "hi";
objj4.lame "ho";
objj1.var = {objj3,objj4};
objj2.var = objj1.var;
echo(
objj1.var[0].lame SPC objj2.var[0].lame);
// this echo outputs "hi hi" because we actually made objj3 and objj4 objects 
__________________

Last edited by Kristi; 04-08-2007 at 10:42 AM..
Reply With Quote
  #17  
Old 04-08-2007, 01:16 PM
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
Quote:
Originally Posted by Inverness View Post
READ MY POST BEFORE YOU MAKE YOURSELF LOOK STUPID
You need a chill pill.
Reply With Quote
  #18  
Old 04-08-2007, 09:09 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
All I want from you people is to tell me why my script doesn't work with those lines commented out, and why it does work correctly when they're not.
Quote:
Originally Posted by Kristi View Post
Stuff
Everything you said was completely wrong. You obviously did not read my post either. I see that I'm not going to get any help on these forums so I'll just notify Stefan of the problem and ask him to check it.

You don't seem to understand the fact that in my script shown in the first post. That the script works fine when the commented-out lines are un-commented.
Quote:
Originally Posted by Twinny View Post
You need a chill pill.
Considering that Hell Raven didn't read it either, I'd say that is justified.
__________________

Last edited by Inverness; 04-08-2007 at 09:19 PM..
Reply With Quote
  #19  
Old 04-09-2007, 04:06 PM
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
Quote:
Originally Posted by Inverness View Post
All I want from you people is to tell me why my script doesn't work with those lines commented out, and why it does work correctly when they're not.

Everything you said was completely wrong. You obviously did not read my post either. I see that I'm not going to get any help on these forums so I'll just notify Stefan of the problem and ask him to check it.

You don't seem to understand the fact that in my script shown in the first post. That the script works fine when the commented-out lines are un-commented.

Considering that Hell Raven didn't read it either, I'd say that is justified.
No, he is right. You do need to chill. Apparently you did not read my post either. You said in that one post copying objects did not work like that. It DOES work like that, so you must have never declared them as objects. I was merely correcting false information you gave to the public.

You are loading the vars from a file. therefore, file is an object, but everything else sub of it is a variable. You do not have to believe me though, just see, for example, what file.muditems[0].type() returns, my bet is that it will not return 2 (an object).

Just like my last post stated, that you need to declare an object, or else it is just a variable. How about actually reading my post instead of just accusing me of not reading yours (sheer hypocracy if you ask me).

Quote:
Originally Posted by Inverness View Post
Everything you said was completely wrong.
That is ironic when what I said works and what you are doing does not work, hense the reason you posted in the first place.
__________________

Last edited by Kristi; 04-09-2007 at 05:32 PM..
Reply With Quote
  #20  
Old 04-09-2007, 11:52 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 Kristi View Post
You are loading the vars from a file. therefore, file is an object, but everything else sub of it is a variable. You do not have to believe me though, just see, for example, what file.muditems[0].type() returns, my bet is that it will not return 2 (an object).
The function MudControl.loadRefs(file); converts all object reference strings in the file into the actual MUD object. You still don't seem to understand the fact that the script works EXACTLY RIGHT when the commented-out lines are added in.

Quote:
Originally Posted by Kristi View Post
That is ironic when what I said works and what you are doing does not work, hense the reason you posted in the first place.
I didn't post the script because it didn't work. I posted the script because the first way that should have worked didn't work, so I used an alternative. Now if you're done trying to fix my script. Please answer my question, Why does the script work when the commented-out lines are added in. I do NOT need anything else from you but that answer.

If you had clearly read my first post you would understand this.

Edit: Its strange that the object array failed to copy while the object in a different non-array variable copied without a hitch.
__________________

Last edited by Inverness; 04-10-2007 at 02:41 AM..
Reply With Quote
  #21  
Old 04-10-2007, 04:33 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
It works because you are using the new command when uncommented. Instead of arguing, see what type that variable is, like I asked before.
__________________
Reply With Quote
  #22  
Old 04-10-2007, 05:15 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
Variable type is 2, an object, live I've been saying.

And for the new command, new [size] constructs an empty array not an object.
It is no different than using setArray(name, size);
__________________
Reply With Quote
  #23  
Old 04-10-2007, 09:14 PM
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
Quote:
Originally Posted by Inverness View Post
Variable type is 2, an object, live I've been saying.

And for the new command, new [size] constructs an empty array not an object.
It is no different than using setArray(name, size);
when you use new, it constructs an array capable of holding objects, something that does not happen when you do not use new. Declare this.whatever a TStaticVar, as i said. You are arguing everything without trying it.
__________________
Reply With Quote
  #24  
Old 04-10-2007, 10:28 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
Since when did you need to construct a blank array before copying one?

I already told you that my script works fine when I add in those comments. You've done nothing but try to find some error in my scripting while not even considering that there could possibly be some obscure bug in the engine. I'm irritated by the fact that you've so highly underestimated my ability to script by making me waste my time by checking if the variable is an object when I know damn well that it is.

The only difference between the two scripts is that the working one makes a blank array before copying each variable (object ref in this case) to the new array. There should not be a difference in copying an array of objects as a whole and copying the individual objects into the blank array.

You have yet to explain to me how this simple change that I'm displaying can affect the outcome of the script and until you do so I'm simply not going to bother seeking assistance since it seems that you are not capable enough.
__________________
Reply With Quote
  #25  
Old 04-11-2007, 11:04 AM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Inverness View Post
Now here is the problem:
PHP Code:
---------
object1.var = {object3object4};
object2.var = object1.var;
//Objects are lost
---------
object1.var = {object3object4};
object2.var = new [object1.var.size()];
object2.var[0] = object1.var[0];
object2.var[1] = object1.var[1];
//Objects are saved 
Please drop the attitude, we are trying to help.

I'm not sure if I've misunderstood where the problem is, but I cannot seem to reproduce this, since the example below is working fine. Is this where your error is occuring?
PHP Code:
function onCreated()
{
  
temp.obj1 = new TStaticVar();
  
temp.obj2 = new TStaticVar();
  
temp.obj3 = new TStaticVar();
  
temp.obj4 = new TStaticVar();

  
temp.obj3.var = "YOU HAVE FAILED TO WATER YOUR CHIA PET";

  
temp.obj1.foo = {temp.obj3temp.obj4};
  
temp.obj2.foo temp.obj1.foo;

  echo(
temp.obj1.foo[0].type()); // producing 2
  
echo(temp.obj2.foo[0].type()); // producing 2

  
echo(temp.obj2.foo[0].var); // producing "YOU HAVE FAILED TO WATER YOUR CHIA PET"

It might be good if you can post some real data from your system that is not copying across properly; if it's a bug then it would be easier to find out how it's happening.
__________________
Skyld
Reply With Quote
  #26  
Old 04-11-2007, 10:30 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
I apologize for the attitude but it frustrates me when people do not read my explanation of the problem and they attempt to find their own problems without fully understanding what is going on.

I've attempted to reproduce this outside the system myself but was unsuccessful. Though my system has a much more complicated handling of objects so I can't really duplicate everything that is affecting the problem.

The data that I tested before and after the copy was the mudid. Its displayed in the echos numbered 1 to 4. Copying the whole array at once will result in the first two echos displaying the correct IDs before the copy and the second two echos being blank. Adding in the comments results in both sets of echos displaying the correct information.

Edit: The scripts are set up on Symphonia Dev for anyone who wants a crack at it, that has global RC of course.
__________________

Last edited by Inverness; 04-11-2007 at 10:44 PM..
Reply With Quote
  #27  
Old 05-30-2007, 01:31 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
So can this be looked into at all? -_-
__________________
Reply With Quote
  #28  
Old 05-30-2007, 08:12 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
HTML Code:
  //Loading all the possible var names...
  vars = file.getVarNames(); 
  //However, you're only wanting to remove this
  vars.remove("mudid"); 
  //Shouldn't it be
  vars.remove(this.muditems[0].mudid);
Looking more into it

HTML Code:
  //You're removing vars, then you're trying to assign a new var...
  vars.remove("mudid"); 
  vars.remove("mudtype"); 
  for (i = 0; i < vars.size(); i ++) { 
    this.(@ vars[i]) = file.(@ vars[i]); 
  }
Use this loop

HTML Code:
  for (temp.currentVar: vars) {
    this.(@ temp.currentVar) = makevar(file.( @ temp.currentVar));
  }
If all else fails, make sure your way of setting the ''new vars'' actually works, try echoing the vars after you've added them. [Don't do the file. stuff, make it all one string being "hello"]

HTML Code:
  for (temp.currentVar: vars) {
    this.(@ temp.currentVar) = randomstring("hello", "hi", "yo");
  }
  echo(this.getVarNames());
__________________
Reply With Quote
  #29  
Old 05-30-2007, 09:13 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
Is everyone on this forum incapable of actually reading my post.

Note 1: My script works PERFECTLY when the commented-out lines are edited in.
Note 2; I stated this several times.

I only want ONE question answered. Why do the commented-out lines make the difference in which this script works and doesn't work?

Quote:
Originally Posted by xAndrewx View Post
HTML Code:
  //Loading all the possible var names...
  vars = file.getVarNames(); 
  //However, you're only wanting to remove this
  vars.remove("mudid"); 
  //Shouldn't it be
  vars.remove(this.muditems[0].mudid);
No, vars is a list of the names of the variables that will be copied, mudid is the name of a variable I don't want copied. Stop trying to fix whats not broken and READ MY POST.
Quote:
Originally Posted by xAndrewx View Post
HTML Code:
  //You're removing vars, then you're trying to assign a new var...
  vars.remove("mudid"); 
  vars.remove("mudtype"); 
  for (i = 0; i < vars.size(); i ++) { 
    this.(@ vars[i]) = file.(@ vars[i]); 
  }
I'm removing the NAMES of vars that would break the mud object considering these are 'read-only' vars and should never be changed. If their name is not in the list, they will not be copied. mudid and mudtype are both assigned by the newObject() function in the MudControl. Once again, this is NOT the problem, READ MY POST.
Quote:
Originally Posted by xAndrewx View Post
HTML Code:
  for (temp.currentVar: vars) {
    this.(@ temp.currentVar) = makevar(file.( @ temp.currentVar));
  }
If all else fails, make sure your way of setting the ''new vars'' actually works, try echoing the vars after you've added them. [Don't do the file. stuff, make it all one string being "hello"]

HTML Code:
  for (temp.currentVar: vars) {
    this.(@ temp.currentVar) = randomstring("hello", "hi", "yo");
  }
  echo(this.getVarNames());
Why are you trying to fix something that isn't broken?
__________________
Reply With Quote
  #30  
Old 06-01-2007, 04:45 PM
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
Quote:
Originally Posted by Skyld View Post
It might be good if you can post some real data from your system that is not copying across properly; if it's a bug then it would be easier to find out how it's happening.
Which you still have failed to do. Show us the data that fails ^_^
__________________
Reply With Quote
  #31  
Old 06-01-2007, 08:51 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 Kristi View Post
Which you still have failed to do. Show us the data that fails ^_^
Do you forget things so easily?
I told you the files were on Symphonia Dev and I gave you RC and NC rights and you even logged on there to look at them yet you never actually did anything or even looked at them. I'm not going to set them up again just for you after I already did.

The files are available for download in this thread, the system I'm talking about would be the second one in the file.

I haven't "failed" to do anything.
__________________

Last edited by Inverness; 06-02-2007 at 08:01 PM..
Reply With Quote
  #32  
Old 07-17-2007, 10:02 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
Bump.
__________________
Reply With Quote
  #33  
Old 08-12-2007, 08:57 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
Bump.

I'm waiting for someone to apologize for being an arrogant jerk.
__________________
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 01:23 AM.


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