Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Army Builder Forums > Army Builder

Notices

Reply
 
Thread Tools Display Modes
Bluefool
Member
 
Join Date: Jan 2006
Location: Iowa City, IA
Posts: 78

Old March 8th, 2006, 02:29 PM
I'm having trouble figuring this out:

val:stat.PtsMax > 0

What should stat.PtsMax be? I thought if the stat was heroiclim, that line should be val:heroiclim.PtsMax, but that won't compile...



var unspent as number
unspent = unit.stat[PtsMax] - unit.stat[PtsUsed]

Same problem here, what exactly is unit.stat[PtsMax], and what is unit.stat[PtsUsed]?
Bluefool is offline   #1 Reply With Quote
rob
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 8,232

Old March 8th, 2006, 03:29 PM
Both of these situations are referring to an actual "unit stat". Do you have a unit stat named "heroiclim"? Or is that just a tag you defined?

If it's a unit stat, they just swap in the name of your unit stat for the sample unit stat. In other words, replace "PtsMax" with "heroiclim".

Given that "heroiclim" is 9 characters long, I'm guessing it's just a tag and not an actual unit stat. If it were a unit stat, it would get truncated after only one digit of value, so that's not a good thing. The example assumes you are working with an actual "unit stat" value, which allows you to easily define a different value for each unit if you want.

Hope this helps,
Rob

At 03:29 PM 3/8/2006, you wrote:

Quote:
I'm having trouble figuring this out:

val:stat.PtsMax > 0

What should stat.PtsMax be? I thought if the stat was heroiclim, that line should be val:heroiclim.PtsMax, but that won't compile...



var unspent as number
unspent = unit.stat[PtsMax] - unit.stat[PtsUsed]

Same problem here, what exactly is unit.stat[PtsMax], and what is unit.stat[PtsUsed]?
rob is offline   #2 Reply With Quote
Bluefool
Member
 
Join Date: Jan 2006
Location: Iowa City, IA
Posts: 78

Old March 11th, 2006, 04:26 AM
Um, what? Me make a stat that was 9 charachters long, and only after implementing it in hundreds and hundreds of items and units, only discover the error after trying to fix something else?

Why...um...*chuckle* no no of course not...heh...nope...not me....


Let's see....edit, search record...heroiclim....yup.

Thanks again Rob .
Bluefool is offline   #3 Reply With Quote
Bluefool
Member
 
Join Date: Jan 2006
Location: Iowa City, IA
Posts: 78

Old March 11th, 2006, 09:42 AM
Hmm...well, no, still not working/making sense.

I went through and changed my stat to htl from heroiclim on everything, so it would be under the charachter limit.

So, the stat is htl.

on the very first part of the guide:

After creating an option, then putting that option in a linkset set as global, in the visibilty section I put this:

val:stat.htl > 0

That gets a compile error:

Syntax error in tag expression for 'visibility' option pc.
Tag 'stat.htl' not defined

val:stat.[htl] > 0

gets a similar problem.

Figuring I would try to get the second part working and just have it show up on all the units for a bit, I tried to work out the second part.

I still can not figure out what or where a unit.stat[PtsUsed] would come from. I have one stat defined: htl. Its a numeric value. I understand unit.stat[htl] will return the vaule that the stat is set for for that unit, so I can't use unit.stat[htl] for the other side of the equation or I'm subtracting the same amount from itself???

Or, any data files out there that actually use this method? The ones I looked at (primarily warhammer) use some other method, as I can'f find an item with a global option, or a option with a cost script???
Bluefool is offline   #4 Reply With Quote
harkan
Senior Member
Volunteer Data File Author
 
Join Date: Mar 2005
Posts: 345

Old March 11th, 2006, 11:02 AM
the expression will need to read:

val:runtime.htl? > 0

The stat is read from the runtime value and the '?' at the end acts as a 'wildcard' that is converted into a value so the matching occurence of htl is turned into a numeric value, i.e. htl5 would be read as 5

p18 of the pdf in the section on roster gives some info about this, cant find the full reference for all of it though sorry, Rob will prob be able to give a more accurate description of it all though
harkan is offline   #5 Reply With Quote
rob
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 8,232

Old March 11th, 2006, 04:26 PM
I strongly encourage you to review the following two sections right away. It's quite possible that you've overlooked a few other valuable tidbits, and it would be better to catch them sooner as opposed to later. :-)

1. In the Tips & Tricks chapter, see the section entitled Naming Systems for Unique Ids.
2. In the Distributing Data Filse chapter, see the section entitled Authoring Checklist.

Hope this helps,
Rob

At 05:26 AM 3/11/2006, you wrote:

Quote:
Um, what? Me make a stat that was 9 charachters long, and only after implementing it in hundreds and hundreds of items and units, only discover the error after trying to fix something else?

Why...um...*chuckle* no no of course not...heh...nope...not me....


Let's see....edit, search record...heroiclim....yup.

Thanks again Rob [img]./modules/mdforum/images/smiles/icon_smile.gif[/img] .
rob is offline   #6 Reply With Quote
rob
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 8,232

Old March 11th, 2006, 04:34 PM
You need to access the information using the appropriate mechanism within each context. Unit stats have their value, which can be accessed via various methods from within scripts. You need to check the docs on the various target references that are available from within each script to determine how to do that (see the chapters on scripting).

In addition, every unit stat has a "runtime" tag that will be automatically defined for it. That tag will always reflect the current value of the stat at the moment the tag is being accessed. If you are trying to access the current value of a stat via a tag expression, then you need to use the "runtime" tag. To do that, you should use the syntax "val:runtime.htl?", just as Harkan suggested.

The problem is that you are trying to use script syntax within the tag expression in your example below. That's why you're getting the compiler errors.

With regards to the "second part" you refer to below, I'm not sure what you're referring to. Please explain and I'll do my best to offer some guidance.

Thanks, Rob


At 10:42 AM 3/11/2006, you wrote:

Quote:
Hmm...well, no, still not working/making sense.

I went through and changed my stat to htl from heroiclim on everything, so it would be under the charachter limit.

So, the stat is htl.

on the very first part of the guide:

After creating an option, then putting that option in a linkset set as global, in the visibilty section I put this:

val:stat.htl > 0

That gets a compile error:

Syntax error in tag expression for 'visibility' option pc.
Tag 'stat.htl' not defined

val:stat.[htl] > 0

gets a similar problem.

Figuring I would try to get the second part working and just have it show up on all the units for a bit, I tried to work out the second part.

I still can not figure out what or where a unit.stat[PtsUsed] would come from. I have one stat defined: htl. Its a numeric value. I understand unit.stat[htl] will return the vaule that the stat is set for for that unit, so I can't use unit.stat[htl] for the other side of the equation or I'm subtracting the same amount from itself???

Or, any data files out there that actually use this method? The ones I looked at (primarily warhammer) use some other method, as I can'f find an item with a global option, or a option with a cost script???
rob is offline   #7 Reply With Quote
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
rob
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 8,232

Old March 20th, 2006, 04:39 AM
The syntax "val:runtime.htl?" is explicitly for use within a TAG EXPRESSION. You're trying to use it within a script, so that's why it's not working. When you are writing a tag expression, you must follow the rules outlined in the chapter the fully describes how to use tag expressions. When writing scripts, you must follow the rules outlined for scripts. They are NOT the same thing.

Take a look at the example more closely. You'll see that there are TWO stats being used. One spcifies the maximum number of points that the unit is allowed to spend, and the second specifies the current total number of points that have been spent. You need to do the same thing with the item limit. You need one stat for the limit and another to track the usage. Then you can compare the two to perform the proper verification. You're currently trying to use the same stat for both the limit and the current usage. The only way that can work is if you subtract the usage from the limit for each item and then verify the total is >= 0.

-Rob


At 06:13 PM 3/18/2006, you wrote:

Quote:
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 [img]./modules/mdforum/images/smiles/icon_wink.gif[/img] .
rob is offline   #9 Reply With Quote
Bluefool
Member
 
Join Date: Jan 2006
Location: Iowa City, IA
Posts: 78

Old March 26th, 2006, 03:34 AM
OK, I put this aside for a few weeks as it was making less and less sense why I ripped apart a functioning method to try to implement this. That aside now, I took a fresh look at it again after reading the documentation from cover to cover all over yet again.

Take a look at the example more closely. You'll see that there are TWO stats being used.

Thats why I asked why I was subtracting the same thing from itself. I knew that weeks ago, what I've been trying to figure out is how to assign a stat to an item. Since I changed all of this over to item based lists, there is no way I can find, and again after multiple re-reads of the docs, to assign a stat to an item.

So I have one stat that specifies the number of points the unit is allowed to spend assigned to the unit.

Now how do I get a second stat that will be useable in, as you say, a TAG EXPRESSION. The item can have exclusion groups. When I have tried to track that, I got slapped down for trying to use the wrong thing, so I know that can't be it. Well, if we're tracking it with a stat, you can't get an item to have a stat. How are you supposed to generate that second value to subtract??

One spcifies the maximum number of points that the unit is allowed to spend, and the second specifies the current total number of points that have been spent. You need to do the same thing with the item limit. You need one stat for the limit and another to track the usage. Then you can compare the two to perform the proper verification. You're currently trying to use the same stat for both the limit and the current usage. The only way that can work is if you subtract the usage from the limit for each item and then verify the total is >= 0.

So you can't subract something non-existant from something. Suprisingly, I did take first grade math and I knew that. What I need to know, is where in the documentation it talks about how to generate that second stat; becuase I've spent a great deal of time trying to find it and can't.
Bluefool is offline   #10 Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 06:55 AM.


Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.