Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Pathfinder Roleplaying Game
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old June 17th, 2012, 07:05 PM
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:
  • maximum(A,B)
    • Returns the value of whichever of A or B is higher
  • minimum(A,B)
    • Returns the value of whichever of A or B is lower
  • round(A,# of decimal places,direction]
    • # of digits is the number of decimal places you want. Pathfinder almost never uses decimals, so this will almost always be 0.
    • direction is the direction to round the number. Entering a number that's less than 0 (like -1) will make it round down. Entering 0 will use normal rounding (0.5 and above rounds up, 0.499999 and below rounds down). Entering a number greater than 0 (like 1) will make it round up. The Pathfinder rules say that rounding down is the default, so you'll almost always be using -1 as the direction to round.
For a more complete list, see here: http://hlkitwiki.wolflair.com/index....age_Intrinsics (operations like raising something to a power, finding roots, and taking the modulus are also available, but won't be commonly used)

Last edited by Mathias; June 19th, 2012 at 09:40 AM.
Mathias is offline   #1 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old June 17th, 2012, 07:06 PM
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:
  • compare(A, B)
    • TRUE/FALSE - this will return 0 if A and B are identical, and a non-zero number if they are not.
  • string replace(A, B, C, 0)
    • This will return a string. A is your base string - the one you want to change. B is what you want to look for within A (capitalization counts). Every time it finds B in that string, it will replace it entirely with C. That 0 at the end needs to be there (it's an advanced setting that I've never needed to use).
  • empty(A)
    • TRUE/FALSE - this will return the number 1 if A is blank and return 0 if there's text in it.
For a more complete list, see here: http://hlkitwiki.wolflair.com/index....age_Intrinsics (operations like finding the length of a string, changing all the characters to uppercase or to lowercase, etc. are also available, but aren't commonly used).

Last edited by Mathias; January 7th, 2014 at 11:41 AM.
Mathias is offline   #2 Reply With Quote
zarlor
Senior Member
 
Join Date: Nov 2010
Location: Metairie, LA, USA
Posts: 1,819

Old March 22nd, 2013, 01:32 PM
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)
zarlor is offline   #3 Reply With Quote
Pathfinder11
Junior Member
 
Join Date: Oct 2014
Posts: 3

Old January 14th, 2015, 07:07 AM
"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.
Pathfinder11 is offline   #4 Reply With Quote
Adoxon_Thanatos
Junior Member
 
Join Date: Feb 2015
Posts: 1

Old February 22nd, 2015, 07:09 AM
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?
Adoxon_Thanatos is offline   #5 Reply With Quote
Reply


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 02:35 AM.


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