View Single Post
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old August 25th, 2009, 11:41 AM
Thank you very much for helping a new user - that sort of help from the more experienced users is what got me through my first data file for Armybuilder.

Other new things in the scripting language:

You can replace:

Code:
if (XXX) then
done
endif
with:

Code:
doneif (XXX)
turning it all into one line of code. This would be used when you have a long script, but you don't want the script to run unless some condition is fulfilled. An example of how to use this would be this, from the barbarian's uncanny dodge ability:

Code:
~ If we're not shown, just get out now
if (tagis[Helper.ShowSpec] = 0) then
done
endif
which should now be written as:
Code:
~ If we're not shown, just get out now
doneif (tagis[Helper.ShowSpec] = 0)
To all users: those lines can be added to most class specials - they mean don't do any more of the script unless we're being shown on the specials list (which doesn't happen if a class variant replaces the ability or the class has not leveled enough to get the ability).

The corresponding code for feats is this:
Code:
~ If we're disabled, do nothing
doneif (tagis[Helper.FtDisable] <> 0)
(this should be used in most or all feats, because the Skeleton template says that the critter loses all existing feats, which is handled in HL by assigning all feats the Helper.FtDisable tag. It's also needed if a class special wants to replace a bonus feat a class is granting).

In prerequisites, you often need the same sort of thing:

Code:
if (XXX) then
@valid = 1
done
endif
Is now:

Code:
validif (XXX)
This would be useful for a complex prerequisite that said the thing is valid under some condition A, but if A is not correct, B and C have to be correct. So, you would put condition A in the validif statement, then put the tests for B and C after that.

The other new convention to cover is that if you have a prerequisite that consists of:

Code:
if (XXX) then
@valid = 1
endif
(so, something that @valid() can apply to), you can save yourself more time by putting it in an expression requisite. In there, all you have to write down is the stuff inside the if statement:

Code:
XXX
And really, this applies to 90% of the prereqs in d20.
Mathias is offline   #27 Reply With Quote