Graal Forums

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

xAndrewx 10-28-2010 12:00 AM

Copying Vars
 
HTML Code:

temp.obj = new TStaticVar();
temp.obj.myvartest = "heyeep";
temp.obj.manpoo = {"gee", "wizz"};


temp.n = new TStaticVar();
temp.n.test = "hey";
temp.n.debug = {"rarr", "lolol"};

temp.obj.copyfrom(temp.n);

When copying from another object, it seems to clear the list? Is this supposed to happen?

If so, is there a way to copy the vars from temp.obj to temp.n without deleting it all?

salesman 10-28-2010 12:36 AM

I just tried
PHP Code:

temp.obj.loadVarsFromArray(temp.n.saveVarsToArray(false)); 

but it seems to clear all existing variables as well =(

fowlplay4 10-28-2010 12:59 AM

Passing TStaticVars to this would work at a basic level.

PHP Code:

function stealValues(a, b) {
  
temp.keys = a.getdynamicvarnames();
  for (
temp.key: temp.keys) {
    
b.(@temp.key) = a.(@temp.key);
  }
} 


xAndrewx 10-28-2010 08:12 AM

Yeah, I thought of doing that but I thought there would be a built in way to resolve this though :(

Thanks! :D


All times are GMT +2. The time now is 10:56 PM.

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