Thread Rating:
- 0 Votes - 0 Average
- 1
- 2
- 3
- 4
- 5
Eval & Expressions
|
Author |
Message |
Pestilence
Apprentice
Posts: 16
Likes Given: 3
Likes Received: 0 in 0 posts
Joined: Oct 2013
Reputation: 0
|
Eval & Expressions
Hey All. :)
Version: 08-01-2015 nightly linux debug
As permanently checking changelog. And people in irc says "every line is evaluated"
Can somebody confirm this ridiculous behaviour:
Code:
[function f_learn]
local.x 1
local.y 10
local.x += 1
local.y -= 5
sysmessage "<dlocal.x> <dlocal.y>" // Returns: "2 5"
local.x 1
local.y 10
local.x+=1
local.y-=5
sysmessage "<dlocal.x> <dlocal.y>" // Returns "1 10"
local.x 1
local.y 10
sysmessage <dlocal.x>+<dlocal.y> // Returns "1+10"
local.x 1
local.y 10
sysmessage <dlocal.x> + <dlocal.y> // Returns "1 + 10"
Just paste it in your sphere and run .f_learn
Looks like trusting and NOT using "eval" in expressions is totally biggest fault for scripting :D
IMHO:
Example #4 shouldn't work because there are spaces...
Example #3 SHOULD work because there are NO spaces and NO quotes
But most killing thing... #2 & #1... now I'm totally unsure can i really use "newgold -= 5000" or "newgold-=5000"
Update:
Code:
[function f_learn]
gold 1000
sysmessage "1000 -> <gold>" // 1000 -> 1000 (works)
gold += 1000
sysmessage "2000 -> <gold>" // 2000 -> 2000 (works)
gold+=1000
sysmessage "3000 -> <gold>" // 3000 -> 1000 (broken)
gold -= 1000
sysmessage "2000 -> <gold>" // 2000 -> 0 (works)
gold-=1000
sysmessage "1000 -> <gold>" // 1000 -> 1000 (broken)
(This post was last modified: 01-08-2015 02:35 PM by Pestilence.)
|
|
01-08-2015 02:12 PM |
|
|
Messages In This Thread |
Eval & Expressions - Pestilence - 01-08-2015 02:12 PM
|
User(s) browsing this thread: 1 Guest(s)