ID:162788
 
Applicable Configuration:
BYOND Version: 410.975
Operating System: Windows XP Professional SP1
Web Browser: Firefox

Descriptive Problem Summary:
I'm actually not 100% sure this is a bug... though I am
positive I have done it before...

text2num doesn't seem to be evaluating addition and subraction, or any of the number operations.
I could have sworn it did this at one point, because I made a power procedure using it.

Code Snippet (if applicable) to Reproduce Problem:
var/number = text2num("1+2+3") // = 1


Expected Results:
It evaluates all of the included operations and returns the number.

Actual Results:
It returns the first instance of a number and ignores the rest.

Does the problem occur:
Every time? Or how often? Every time.
In other games? Haven't tried.
On other computers? Haven't tried.
In other user accounts? Haven't tried.

When does the problem NOT occur?
When you don't do it.

Workarounds:
Create a procedure that converts text strings to numbers and includes evaluation of number operations.
That's not how text2num() works. text2num() just converts a text string to a number, ignoring anything after the first non-number it finds. I'm pretty sure there's a proc that does what you want but for the life of me I can't think of it. Hopefully someone else replies who knows -- if not I can look through the reference later and see if I can find it.
In response to Nadrew
eval() should be able to handle it.
In response to Audeuro
And eval() is...?
In response to Kaiochao2536
It evaluates, I'd assume.
It doesn't seem to be documented though.
In response to Keeth
Indeed. eval() is an undocumented and buggy proc that was meant to evaluate DMScript. For simple things like this, however, it works nicely.
In response to Nadrew
http://developer.byond.com/hub/AbyssDragon/SET comes to mind.

I think Yota's Evaluate library might be similar but I haven't looked at it in detail.

There may be some others too.