Author Topic: Making a global variable using normal variables  (Read 1131 times)

Ok, I'm making an RPG system, and I need to know how I can use normal vars to make global vars.

For example, the export function. You can customize that variable as you desire.

How would I do this with one of my functions?

Please, someone help with this!



no, noob
Moron.

@ Kalphiter, I think he wants to set global variable(s) with an actual client variable.

Like:
%client.Name = $Name;


Bad example.
Indeed, it's kinda hard to create a peice of code when you don't know exactly what they want though.

Code: [Select]
function serverCmdCreateGVar(%client,%Type,%Stuff)
{
$Roleplay[%Type] = %Stuff;
}

$BL_ID_count++;
$BL_ID_N[$BL_ID_COUNT]=%client.bl_id;
...
$Value[%client.bl_id]=%client.value;
...
%i=1;
while(%i <= $BL_ID_count){
%line=$Value[$BL_ID_N[%i]];
...
etc..



Indeed, it's kinda hard to create a peice of code when you don't know exactly what they want though.
It's bad because of the variable name you used

It's bad because of the variable name you used
My statement still stands, he said that he wanted to know how to make "normal vars to make global vars.". That was an example, it shouldn't have been so generic but eh.

Ok, I'm making an RPG system, and I need to know how I can use normal vars to make global vars.

For example, the export function. You can customize that variable as you desire.

How would I do this with one of my functions?
Deciphering tips:
RPG system
use normal vars to make global vars.
the export function

Saving and loading I presume.

$ = Global variable.

% = Local variable.

(lol)  :cookieMonster:

No. What im trying to tell you here is that I want to be able to do something, for example, the first argument of the export function.

I want to make a string in an argument become a global variable that I can do stuff with.

EDIT: This might explain it.



RPGSys.addRPGVar("Gold",1,%client);
---
$RPG::[RPGSys.modeName]::[%arg1]::client[%arg3.bl_id] += %arg2;
« Last Edit: December 23, 2009, 06:04:11 PM by Club559 »

function RPGaddvariable(%name){
   $RPG_variables++;
   $RPG_variable[$RPG_variables]=%name;
}

function RPGaddclient(%client,%name,%amount){
   $RPG_variable_cl[%name,%client]+=%amount;
}

RPGaddvariable("gold");
RPGaddclient(findclientbyname("rky"),"gold",5);

Well, my system doesnt work that way, but if it's the only answer I can find, I guess I'll go for it. Thanks.