Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
The basic syntax is correct but HL cares about capitalization. So its "Race.rDwarf". "rDwarf" is the unique id of the Dwarf Thing.if (hero.tagis[race.dwarf] <> 0)
if (#hasrace[rDwarf] = 0) then
All this is covered in the videos or FAQ#9. Basically turning on and using debug tools.this should evaluate the current portfolio to see if the race is set to dwarf (I think).
What I am unsure of, is if I have built the field/content correctly. When I use the "findthing" button, and locate the race, it gives me something different (rDwarf). so, should I be using rDwarf? or is that a different way to reference the object?
I am wondering where I may find the canonical naming for these. Or better yet, even a list of the actual fields on the character. I have done a bit by picking out examples that already live in the system to lean some naming syntax for my custom items, but when it comes to some of the core items for the game system I am not sure where to find them.
Figured its easier to setup if each Race is its own Simple Thing. I say Pre-Req as they are easy to use instead of Eval Rules. You don't need the added power of Eval Rules. And we are doing pre-req logic so Eval Scripts won't help you.Outside of that and returning to the question at hand. You suggested that I create a simpleThing ( I think this is the Simple tab). There are a number of options - and I see you suggested using Pre-Reqs to perform this. I assume there is a reason this is preffered, and not the eval scripts, or Eval Rule?
On each Simple Thing I would do one Pre-Req per Class/Race combo.Should I create a Pre-req for each class combination for the race, or would it be ok to just use a single if statement to test all of the possible offending classes?
#hasrace[rElf] + hero.tagis[Classes.Inquisito] <> 2
Hmmm. I am not any where near HL so its possible I told you the wrong section to put the script into. I can double check once I am home. Some times I mix up the names...Interestingly enough though I get "unspecified error parsing script" when trying what you put in the code block.
Yeah I think the list was removed. I use a google sheet that AndrewD2 put together HERE. He does a good job of keeping it updated.You mentioned this is a macro, which is great. The documentation also said macros could be found on the Menu, but this does not appear to be the case anymore. Is there someplace where all the Macros are listed?
That is sort of a complex question. Tags are very powerful and should be used more than a field on average. But many times the value you need is easier to use a field. It sort of depends on WHERE you are running.Also - is there preference in using fields vs tags? I see in my testing that many of these overlap and I could go to either a tag or field for the information.
Yeah my bad! The above type of Pre-Req script goes on a "Expr-Reqs" section not the "Pre-Reqs" section. Expr-Reqs are the short simple way of doing error checking. You put in the basic script above and a "Message" and away you go.Code:#hasrace[rElf] + hero.tagis[Classes.Inquisito] <> 2
validif (#hasrace[rElf] + hero.tagis[Classes.Inquisito] <> 2)
~ Default to valid
@valid = 1
~ If we are an Elf and Inquisitor we are invalid
If (#hasrace[rElf] + hero.tagis[Classes.Inquisito] = 2) then
@valid = 0
endif
~ Default to valid
@valid = 1
~ If we are an Elf and Inquisitor we are invalid
If (#hasrace[rElf] + hero.tagis[Classes.Inquisito] = 2) then
@valid = 0
endif
This is a feature not bad thing. Each TYPE of script has different uses. Expr-Reqs are great because they are very small and simple to use. You don't have to know about @value or if/then/else logic. Just put in your condition and HL does the rest.ew. kinda stinks that things are handled differently in the various tools.
validif and doneif are complete "IF" statements that return true/false. You can't use else or elseif logic with them. Hence why I gave both examples. These are constructs of the language that make doing code easier.Can I use the validif with then/else statements as well? or do I just drop to a if statement instead?
Correct.And the message box is triggered when the state is determined to NOT be valid, correct? So any statement I create that does not meet the test results displays the message box. Just want to make sure I am understanding this correctly.
@ variables are predefined HL variables as AndrewD2 said. If you want to make your "own" variable up you can do this:and the @ lets us declare a variable on the fly, that we can update, correct? Is this variable persistent for the time the characters is open? Or only during the time the check is performed? are these global variables that could be updated by other scripts/checks? Just trying to understand if I should be clearing them out or not.
var NewVar as string
var NewVar2 as number
hero.childfound[fPowAtt].field[abValue2].value += 1
#value2[fPowAtt] += 1
There is the "notify" function that will pop up a window. But that window will POP up every time anything changes on the character. But it would get your players attention.I have it working, but notice that the exception is easy to miss. I guess this is just how HL handles these types of things. I was expecting a modal message box or something similar.
Any Pre-Req checking should happen REALLY late like in the Validation timing actually. Unless you have some "specific" reason not too.As to timing - since this is when a character is picking a level I noticed that there were 3 different timings around that : Pre-level, Levels, Post-Levels. Based upon what you said in a previous post I am assuming this check should happened Post-levels. My search-fu suggested this should maybe be happening in the 15000 range. (still trying to figure out timing).
#hasrace[rathdwarf] + hero.tagis[Classes.Magus] <> 2
~This generates a warning message that is visible to the
~user via the notification box and status bar.
~ Default to valid
@valid = 1
~ If we are an Dwarf and Magus we are invalid
If (#hasrace[rathdwarf] + hero.tagis[Classes.Magus] = 2) then
notify "Dwarves may not take the Class: Magus"
~This generates a pop-up window that the user must acknowledge
endif
Yep great plan. So much so that the editor supports this as a feature. You go to the Tools menu to use a user identity. It only uses 2 characters but that way say "at" or "ah" would get auto added to the Unique ID for you.(from my time creating add-ons for other games, I always prefix my objects with a unique identifier - in this case 'ath' - so I know what is my stuff).