ID:141717
 
Code:
stat
var
max
value
New(n,n1)
if(n && n1)
max = n1
value = n
proc
ToText()
return "[value]/[max]"


Problem description:
This is my stat code, and everytime I try and use user.strength.ToText() user is mob/user I get a error of can't run ToText(). A little help..

Is strength under /mob/var/stat?
You shall show more of your code, by the way, i prefer setting variables (all ones) to 0 instead of none.
Try strength.ToText() without the "usr." bit. Also if you showed how you defined strength, it would help.
In response to Kaiochao
Yes,
mob
var
stat
strength
dexterity
endurance
speed
intelligence
willpower
wisdom

rage
focus
I fail to understand this, couldn't you just simply do something like:
#define ToText(a, b) "[a]/[b]"

And to use it, something like:
mob
verb
test()
world << ToText(12, 15) //Outputs 12/15
In response to Tiberath
It was in an article, that was teaching datums. It was needed to display two values, for like current value and max value.

stat
var
value = 0
max_value = 0
New(n,n1)
if(n && n1)
value = n
max_value = n1
proc
ToText()
return "[value]/[max_value]"

Meaning if I defined it like that, I would have to type in for every stat ToText(strength.value,strength.max) vs. strength.ToText() which inputs that.

Oh did I say I Solved this...lol
In response to Lundex
Erm, it seems you defined a stat datum, but you never actually created an instance, of it, stored in a declared var(iable), so the code should not even compile, unless I missed something important, or you missed to post something important.

Note, I might be completely wrong about this, in which case I'd like to say sorry in advance ;)
In response to Schnitzelnagler
That code will compile, but it will have the exact problems he described until he actually instantiates any of those stats. Of course he still hasn't shown where he's actually calling ToText(), but the obvious conclusion is that whichever mob he's using, its strength stat datum is null.

Lummox JR