Member
Join Date: Aug 2010
Posts: 50
|
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 Quote:
|
|
#1 |
Member
Join Date: Aug 2010
Posts: 50
|
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)" |
#2 |
Member
Join Date: Aug 2010
Posts: 50
|
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 |
#3 |
Member
Join Date: Aug 2010
Posts: 50
|
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 |
#4 |
Senior Member
Volunteer Data File Contributor
Join Date: Aug 2009
Posts: 1,556
|
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 |
#5 |
Member
Join Date: Aug 2010
Posts: 50
|
Yes, that is exactly what I want it to do if there is a dash in the ROF. Please show me.
|
#6 |
Senior Member
Volunteer Data File Contributor
Join Date: Aug 2009
Posts: 1,556
|
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 |
#7 |
Senior Member
Volunteer Data File Contributor
Join Date: Aug 2009
Posts: 1,556
|
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. |
#8 |
Member
Join Date: Aug 2010
Posts: 50
|
Thank you very much for the assistance with this.
|
#9 |
|
|