Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
This article is part of a collection of editor and scripting articles: http://forums.wolflair.com/showthread.php?t=21688
In Hero Lab's scripting languages, the standard math operations are of course available: + - * / So, you can write instructions like: hero.child[skClimb].field[Bonus].value = hero.child[skClimb].field[Bonus].value + 2 There's also a way to abbreviate that, so you don't have to type as much: += -= *= /= Here's the same instruction, with the abbreviation: hero.child[skClimb].field[Bonus].value += 2 These abbreviations remove the need to repeat the base thing. Other common math operations:
Last edited by Mathias; June 19th, 2012 at 09:40 AM. |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Here's how to add one piece of text to another in Hero Lab's scripting language:
string = "The quick brown fox" & "jumped over the lazy dog." will set the variable 'string' to: "The quick brown foxjumped over the lazy dog" Note how I forgot to put an extra space in there. Correcting that: string = "The quick brown fox" & " " & "jumped over the lazy dog." Let's say 'string' has already been set to "The quick brown fox", and you want to add more text to it. Here's how to do that: string = string & " " & "jumped over the lazy dog." or, you can abbreviate that, in order to save typing: string &= " " & "jumped over the lazy dog." Other common string operations:
Last edited by Mathias; January 7th, 2014 at 11:41 AM. |
#2 |
Senior Member
Join Date: Nov 2010
Location: Metairie, LA, USA
Posts: 1,819
|
Great stuff. Thanks, Mathias!
Lenny Zimmermann Metairie, LA, USA Data files authored (please let me know if you see any issues with any of these if you have/use them): Official (In the downloader) 50 Fathoms, Deadlands: Hell On Earth, Deadlands: Noir, East Texas University, Necessary Evil (requires Super Powers Companion), Pirates of the Spanish Main, Space 1889 (original file by Erich), Tour of Darkness, Weird War II, Weird Wars: Rome Coming Eventually Evernight (LWD has completed their review but I have some fixes to make first... although Pinnacle mentioned this might get an overhaul to SWADE so I may just wait for that first. If you just HAVE to have this now, though, just PM me) |
#3 |
Junior Member
Join Date: Oct 2014
Posts: 3
|
"hero.child[skClimb].field[Bonus].value = hero.child[skClimb].field[Bonus].value + 2"
Is there a write-up on what a string like this means? What is it telling HL to do? Is there a breakdown? Thanks, Edward Nevermind, I saw it on the next post Location Location Location Last edited by Pathfinder11; January 14th, 2015 at 07:11 AM. |
#4 |
Junior Member
Join Date: Feb 2015
Posts: 1
|
Why doesn't something like this work?
var id as string hero.childfound[id].field[cGiveSpec].value+=1 What am I getting wrong? Is there a way to do something like this? |
#5 |
|
|