Author Topic: Variable commands  (Read 1590 times)

Sorry for being dumb, but what are the commands for adding, checking, subtracting, setting and displaying variables?

Also as a side note, how do I add a delay before a line of script is run?
« Last Edit: January 12, 2013, 05:12:27 PM by Alpherio »

Code: [Select]
%addtest = 2+2; //Adding a variable
%subtracttest = 4-4; //Subtracting a variable
%settingtest = %subtracttest + 5; //Setting the answer for %subtracttest to the same value plus 9
echo(%settingtest); //Printing the value of %settingtest

Code: [Select]
%addtest = 2+2; //Adding a variable
%subtracttest = 4-4; //Subtracting a variable
%settingtest = %subtracttest + 5; //Setting the answer for %subtracttest to the same value plus 9
echo(%settingtest); //Printing the value of %settingtest

Code: [Select]
%settingtest = %settingtest + 5; //Setting the answer for %subtracttest to the same value plus 9
Code: [Select]
%settingtest += 5; //Setting the answer for %subtracttest to the same value plus 9


I'm trying to make a script for a gun overheating if you fire it too much, could anybody tell me whats wrong with it

   %heat += 1
   
   if(%heat >= 3)
   {
   %obj.spawnExplosion(AntimatterProjectile,"2 2 2");
   %obj.client.player.addhealth("-35");
   messageclient(%client, 'centerprint', "Overheating!"   10)
   }
   
   %obj.schedule(1000, %heat -= 1);

%heat is a local variable that gets reset every time you fire. You'll need to do %obj.client.player.heat or something.

It's giving me a syntax error at

   if(##%##obj.client.player.heat >= 4)


It's giving me a syntax error at

   if(##%##obj.client.player.heat >= 4)
...post the full code please

Its the same code as before, but the %heat changed to %obj.client.player.heat

   %obj.client.player.heat += 1
   
   if(%obj.client.player.heat >= 4)
   {
   %obj.spawnExplosion(AntimatterExplosion,"2 2 2");
   %obj.client.player.addhealth("-35");
   messageclient(%client, 'centerprint', "Overheating!"   2)
   }
   
   %obj.schedule(1000, %obj.client.player.heat -= 1)

%obj.schedule(1000, %obj.client.player.heat -= 1)

You can't do that like that.

Could you tell me how I can then? I'm just looking at tutorials on the forums


I can help you when i get home. Add me on RTB.

I have a hunch that this code isn't even in a function, let alone ::onFire