Author Topic: Basic Math Problems  (Read 984 times)

How do I set a variable to be 100 LESS than it's original value?  I tried...
Code: [Select]
$rackunit = $rackunit - 100and
Code: [Select]
$rackunit = {$rackunit - 100}and
Code: [Select]
$rackunit - 100
but nothing seems to work

what do

Many ways to do it

Code: [Select]
%var = %var - 100;
%var -= 100;
%var += -100;
etc.

Anyway be careful, you haven't used a semicolon in any of your examples. You may want to look at a scripting tutorial about basics, you seem pretty uninformed about scripting syntax in general.
« Last Edit: April 26, 2012, 08:13:23 PM by Treynolds416 »

$rackunit -= 100;

the first one would have worked if you remembered a semicolon, but you can set a variable with maths (what a horrible way to explain it, haha) by just doing op= instead of =.


ie +=, -=, *=, /=


Warning - while you were typing a new reply has been posted. You may wish to review your post.
welp

i think the second one would've worked too with a semicolon
in java {} are used by for/while/if and other statements, but can also stand alone, so i'd assume it'd not affect anything here either

i think the second one would've worked too with a semicolon
in java {} are used by for/while/if and other statements, but can also stand alone, so i'd assume it'd not affect anything here either
this is not java

unless it's some long lost syntax rule i've never heard of, that won't work

Couple more questions, but they are more about variables than math.

Code: [Select]
function serverCMDjoin(%cl, %faction)
{
announce(%cl.name @ " has joined " @ %faction);
// %cl.clanprefix = %faction
}
Stuff with // before it doesn't work.

you forgot a semicolon

you forgot a semicolon
I'm noticing a trend with my variable errors.  :cookieMonster:

You should
Go to add-ons folder
Open System_MunkServerPack/Main.cs
And let it teach you

You should
Go to add-ons folder
Open System_MunkServerPack/Main.cs
And let it teach you

you make me want to hit myself with a blunt object


this is not java

unless it's some long lost syntax rule i've never heard of, that won't work
similar though, is what i'm saying
i wouldn't be surprised if it didn't give any errors

similar though, is what i'm saying
i wouldn't be surprised if it didn't give any errors
i would

you make me want to hit myself with a blunt object
Then do it

Then do it

you make me want to hit myself with a variety of blunt and sharp objects repeated several times