Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Quick Assignment question

Front Dawes
Registered User
Join date: 28 Oct 2007
Posts: 76
06-30-2008 06:29
The Assigment examples in the wiki deal with a variable +1 or -1

So how do I say

variable = variable - 0.1

in LSL?

Front
Lennard Lopez
Registered User
Join date: 9 Oct 2007
Posts: 52
06-30-2008 06:32
Have you tried:

variable = variable - 0.1; ???
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
06-30-2008 06:52
variable = variable - 0.1;

variable -= 0.1;

for increments or decrements of 1 you may also want to use:

++variable or variable++
--variable or variable--

note that if the ++ or -- is to the LEFT of the variable, that operation will be carried out first, before the rest of your equation takes place if the variable is part of an equation. If the ++ or -- is to the RIGHT, then the equation will be calculated first, and then the variable will be incremented or decremented.
Vi Shenley
Still Rezzing
Join date: 24 Oct 2006
Posts: 103
06-30-2008 10:06
From: Squirrel Wood
variable = variable - 0.1;

variable -= 0.1;

for increments or decrements of 1 you may also want to use:

++variable or variable++
--variable or variable--

note that if the ++ or -- is to the LEFT of the variable, that operation will be carried out first, before the rest of your equation takes place if the variable is part of an equation. If the ++ or -- is to the RIGHT, then the equation will be calculated first, and then the variable will be incremented or decremented.


Thanks Squirrel, clear concise answer.

Does

variable =- 0.1;

produce anything sensible?

Front
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
06-30-2008 10:24
From: Vi Shenley
Does

variable =- 0.1;

produce anything sensible?

Do you consider compiler errors to be sensible? If not, the answer is 'no'.

It's gotta be the operator then the equals sign.. +=, -=, *=, /=.


From: Lennard Lopez
Have you tried:

variable = variable - 0.1; ???

LOL..
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left