Blockland Forums > Modification Help
Variables in functions?
(1/1)
LundoomGaming:
Hey, I wanted to create a customizeable script thing, and part of it would be

%test = "Derp";
%derp = getData(%client.bl_id).value%testAmount

To use a variable in that function, would I have to do something like

%eval = "%test = "derp"; getData(%client.bl_id).value" @ %test @ "Amount;";
eval(%eval);

?
Kalphiter:
Arrays work like names.


This echoes two of the same thing:

%q = "SSS";
echo($myvarSSS);
echo($myvar[%q]);
LundoomGaming:

--- Quote from: Kalphiter on March 17, 2012, 01:09:40 PM ---Arrays work like names.


This echoes two of the same thing:

%q = "SSS";
echo($myvarSSS);
echo($myvar[%q]);

--- End quote ---

Is that suppost to mean that I need to do
%test = "derp";
%derp = getData(%client.bl_id).value[%test]amount();
?
Kalphiter:
I don't understand what you are trying to do.
Chrono:

--- Quote from: LundoomGaming on March 17, 2012, 01:12:09 PM ---Is that suppost to mean that I need to do
%test = "derp";
%derp = getData(%client.bl_id).value[%test]amount();
?


--- End quote ---
Huh, you changed from getting just a value to using it in a function.
Try
%derp = getData(%client.bl_id).value[%test];

The "amount" just seems redundant.
Navigation
Message Index

Go to full version