Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Referencing variables dynamically.. (https://forums.graalonline.com/forums/showthread.php?t=134261610)

12171217 01-08-2011 10:11 PM

Referencing variables dynamically..
 
How can I reference a variable based on a string with it's name in it?

I can do:

PHP Code:

object "player";
var = 
"x";
player.chat = (@object).(@var); 

but I can't do:

PHP Code:

var = "mousex";
player.chat = (@var); 

Any ideas?

xXziroXx 01-08-2011 10:12 PM

Try:

PHP Code:

makevar(var) 

Despite the hatred towards makevar() that a lot of scripters seems to have, there's just some things it does best.

12171217 01-08-2011 10:38 PM

Works a charm.. Thanks!


All times are GMT +2. The time now is 07:38 PM.

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