Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Variable linking? (https://forums.graalonline.com/forums/showthread.php?t=71633)

Inverness 01-23-2007 12:44 AM

Variable linking?
 
How do I link a TGraalVar to another so when I change one the other reflects the change?

Cyrioux 01-23-2007 01:18 AM

If you are talking of TGraalVar as object just use addcontrol and change vars reversibly at the child node with getparent?

Im talking nonsense... these are GUI functions. X_o

Well, script your own function. :>

Skyld 01-23-2007 01:20 AM

Quote:

Originally Posted by Inverness (Post 1267682)
How do I link a TGraalVar to another so when I change one the other reflects the change?

I think b = a.link() might be what you are looking for, but I am not certain how well it works.

Inverness 01-23-2007 01:28 AM

Quote:

Originally Posted by Skyld (Post 1267724)
I think b = a.link() might be what you are looking for, but I am not certain how well it works.

I've tried that about 10 times, and its never once worked so I came here to ask.

Riot 01-23-2007 03:54 AM

I did testing with .link() awhile back and was rather unsatisfied with the results I got.

HTML Code:

  this.var = 4;
  temp.var = this.var.link();
  temp.var++;
  echo("temp.var - " @ temp.var @ " this.var - " @ this.var);

Outputs: temp.var - 5 this.var - 4

HTML Code:

function onCreated()
{
  this.var = 1;
  getVar()++; // Works
 
  temp.var = getVar();
  temp.var++;
  echo("temp.var - " @ temp.var @ " this.var - " @ this.var);
}

function getVar()
{
  return this.var.link();
}

Outputs: temp.var - 3 this.var - 2

Inverness 01-23-2007 05:36 AM

I would really like if this was fixed >_>

Admins 01-23-2007 03:21 PM

Well for normal variant variables (TGraalVar) the linking is undone once you assign them to some other variable, but it works as function parameter (passing arrays to a function which can modify it). It is not planned to make it work in other ways.


All times are GMT +2. The time now is 04:55 PM.

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