View Single Post
Bluefool
Member
 
Join Date: Jan 2006
Location: Iowa City, IA
Posts: 78

Old March 18th, 2006, 05:13 PM
Well, some down, but not yet there. No more compile errors on the visibility, thanks guys! Its got:

val:runtime.htl? > 0

And this makes sense to me.

The "second part" is the second example code block from Handling Units with Resource Pools.

The example is this:

~ Get the number of unspent points
var unspent as number
unspent = unit.stat[PtsMax] - unit.stat[PtsUsed]
~ Determine if more points were used than allowed
var is_exceed as number
if (unspent >= 0) then
is_exceed = 0
else
is_exceed = 1
endif
~ Set the option name to the unspent points remaining and use red if exceeded
name = "Item Points Left: " & unspent
if (is_exceed > 0) then
name = "{text ff0000}" & name & "{text 010101}"
endif


I'm using:

~ Work out how many points of items we're allowed
var result as number
result = unit.stat[htl] - val:runtime.htl?

~ Check to see if I'm over the limit
var is_exceed as number
if (result >= 0) then
is_exceed = 0
else
is_exceed = 1
endif

~ Set the option name to the unspent points remaining and use red if exceeded
name = "HT Points Left: " & result

if (is_exceed > 0) then
name = "{text ff0000}" & name & "{text 010101}"
else
name = "{text 80ff80}" & name & "{text 010101}"
endif

Its defining that val:runtime.htl? sucker; it gives me a compile error every time.

I've read and read read all the doc's mentioned, tried numerous combinations of syntax expression: result = (unit.stat[htl] - val:runtime.htl?), etc

And still compile errors.

As long as I cut out "side two" of the expression:

----------side one--------side two
result = unit.stat[htl] - val:runtime.htl?

It will compile, but of course I never calculate how much of htl got used, so its rather pointless. But, it does let me know thats got to be where I'm still making the error.

So, why is it working in visibility, but not in cost? I've been beating my head into this one for too many hours now to give up, but I'm starting to wonder if a item count was really worth it .
Bluefool is offline   #8 Reply With Quote