Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Savage Worlds
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
javadragon
Member
 
Join Date: Aug 2010
Posts: 50

Old March 23rd, 2014, 05:01 PM
I am attempting to create a custom data file for a home brewed fantasy campaign setting for Savage Worlds. I am attempting to create a new edge called Fast Shot that will increase the ROF of the character's bow by 1. Unfortunately it appears that ROF is a text field and therefore my Eval Script:

Code:
foreach pick in hero from WeapRange
    ~ TODO: need to look at weapon name for the word bow
    eachpick.field[wpFireRate].value += 1
nexteach
does not work as I get the error:

Quote:
Attempt to access text-based field 'wpFireRate' as a value.
I thought that all ROF's were integers until I looked at the core book and saw some ranges of "1-2". Is there a way that I can write some code to check the ROF field value and if it is a number then increment it by one? Or do I just need to make a note in my edge that the player needs to note this increase for themselves.
javadragon is offline   #1 Reply With Quote
javadragon
Member
 
Join Date: Aug 2010
Posts: 50

Old March 23rd, 2014, 05:21 PM
That or is my only option appending text to this field to say "+1"? If this is the case, will:

Code:
eachpick.field[wpFireRate].text = eachpick.field[wpFireRate].text & " (+1)"
javadragon is offline   #2 Reply With Quote
javadragon
Member
 
Join Date: Aug 2010
Posts: 50

Old March 23rd, 2014, 05:30 PM
After some searching on type conversion, I came up with this which seems to work:

Code:
var rof as number
foreach pick in hero from WeapRange
    ~ TODO: need to look at weapon name for the word bow
    rof = eachpick.field[wpFireRate].text  +1
    eachpick.field[wpFireRate].text = rof
nexteach
By reading type conversion on the WIKI, it seems that "1-2" will be converted to 1 and then have the arithmetic applied.
javadragon is offline   #3 Reply With Quote
javadragon
Member
 
Join Date: Aug 2010
Posts: 50

Old March 23rd, 2014, 06:40 PM
For other user's reference, here is what my completed code looks like:
Code:
var rof as number
foreach pick in hero from WeapRange
    ~ if this is a bow weapon
    if (eachpick.tagis[Weapon.Bow] <> 0) then
        rof = eachpick.field[wpFireRate].text + 1
        eachpick.field[wpFireRate].text = rof
    endif
nexteach
javadragon is offline   #4 Reply With Quote
CapedCrusader
Senior Member
Volunteer Data File Contributor
 
Join Date: Aug 2009
Posts: 1,550

Old March 26th, 2014, 06:41 PM
Would you rather have that convert to "2-3"? I can show you how to pull the numbers out of the string, manipulate them, and put them back...

_
Currently In Development: Savage Pathfinder, SWADE Fantasy Companion
Future Development: SWADE Super Powers Companion, SWADE Sci-Fi Companion
_
Currently Running: Savage Unity Inc. (homebrew multiverse theme)
Setting Files Supported: Deadlands: Reloaded, Flash Gordon, Gaslight, Hellfrost, Interface Zero 2.0, Seven Worlds, Slipstream, Solomon Kane
Future Setting Files: Savage Judge Dredd
CapedCrusader is online now   #5 Reply With Quote
javadragon
Member
 
Join Date: Aug 2010
Posts: 50

Old March 28th, 2014, 03:18 AM
Yes, that is exactly what I want it to do if there is a dash in the ROF. Please show me.
javadragon is offline   #6 Reply With Quote
CapedCrusader
Senior Member
Volunteer Data File Contributor
 
Join Date: Aug 2009
Posts: 1,550

Old April 7th, 2014, 09:12 AM
Alright, I'll work something up...

_
Currently In Development: Savage Pathfinder, SWADE Fantasy Companion
Future Development: SWADE Super Powers Companion, SWADE Sci-Fi Companion
_
Currently Running: Savage Unity Inc. (homebrew multiverse theme)
Setting Files Supported: Deadlands: Reloaded, Flash Gordon, Gaslight, Hellfrost, Interface Zero 2.0, Seven Worlds, Slipstream, Solomon Kane
Future Setting Files: Savage Judge Dredd
CapedCrusader is online now   #7 Reply With Quote
CapedCrusader
Senior Member
Volunteer Data File Contributor
 
Join Date: Aug 2009
Posts: 1,550

Old April 21st, 2014, 07:24 PM
Forgive me for taking so long...

Try this:

Code:
var rof as number
var rof2 as number
foreach pick in hero from WeapRange
    ~ if this is a bow weapon
    if (eachpick.tagis[Weapon.Bow] <> 0) then
        if (pos(eachpick.field[wpFireRate].text,"-") <> -1) then
            rof  = left(eachpick.field[wpFireRate].text,1) + 1
            rof2 = right(eachpick.field[wpFireRate].text,1) + 1
            eachpick.field[wpFireRate].text = rof & "-" & rof2
        else
            rof = eachpick.field[wpFireRate].text + 1
            eachpick.field[wpFireRate].text = rof
        endif
    endif
nexteach

The other function that's useful for this type of thing is mid. It allows you to vary the start position

example: rof2 = mid(eachpick.field[wpFireRate].text,3,1) + 1

[right] and [left] are substring functions that take the designated number of characters from that end of the string. [mid] allows you to start anywhere (the first number) and take a given number of characters (the second number). The [pos] function finds a designated set of characters in a string. It reports back starting with position 0, with a -1 if it doesn't find the given characters.

_
Currently In Development: Savage Pathfinder, SWADE Fantasy Companion
Future Development: SWADE Super Powers Companion, SWADE Sci-Fi Companion
_
Currently Running: Savage Unity Inc. (homebrew multiverse theme)
Setting Files Supported: Deadlands: Reloaded, Flash Gordon, Gaslight, Hellfrost, Interface Zero 2.0, Seven Worlds, Slipstream, Solomon Kane
Future Setting Files: Savage Judge Dredd

Last edited by CapedCrusader; April 21st, 2014 at 09:36 PM.
CapedCrusader is online now   #8 Reply With Quote
javadragon
Member
 
Join Date: Aug 2010
Posts: 50

Old May 31st, 2014, 04:40 PM
Thank you very much for the assistance with this.
javadragon is offline   #9 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:13 PM.


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