Eval & Expressions - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Help (/Forum-Script-Help) +--- Thread: Eval & Expressions (/Thread-Eval-Expressions) |
Eval & Expressions - Pestilence - 01-08-2015 02:12 PM 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] 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] RE: Eval & Expressions - eberk - 01-08-2015 07:15 PM local.x+=XXXX without space to equal symbol ( = ) i think sphere read it like "YYYY=XXXX" means YYYY for 'local.x+' and XXXX is value, so in your example can u check (for example #2) Code: local.x 1 and sysmessage command (#3,#4) i think it want string value so actually you have to do it like Code: local.x 1 RE: Eval & Expressions - Extreme - 01-09-2015 11:41 AM Just use eval everywhere.. 100% sure it will work RE: Eval & Expressions - Pestilence - 01-09-2015 12:38 PM (01-09-2015 11:41 AM)Extreme Wrote: Just use eval everywhere.. That's what I really started doing RE: Eval & Expressions - XuN - 01-11-2015 02:01 AM I'm not sure if I did understand this but this is my contribution: - You should use local.bla += x and NOT local.bla+=x - Values are stored in hex, so it doesnt matter if you use local.bla = <eval 8+2> and local.ble = <dlocal.bla> because they will be stored as '0a' anyways, so using evals to storage is a waste of cpu. - Numerical strings SHOULD be eval'ed to output them RE: Eval & Expressions - Pestilence - 01-11-2015 03:37 PM Xun, My question was related only to #1 but having stuff like "attr=010" and then you see "color += 01", slightly messing, isn't? |