Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[DMgenie] Breath weapon

5 views
Skip to first unread message

vampiregoat69

unread,
Apr 29, 2015, 10:44:36 AM4/29/15
to

I am using a script for breath weapon counter and I can't figure out WTF I need to set in the description for it to understand it.The creature I want has a 7d8 damage from fire and I wanted it 1d4 rounds.I tried to use the syntex it uses to put the damage and rounds in the description only for it to tell me NOPE.

I copied Breath Weapon.*:.*\r into the description and tried 7d8.1d4\r and I am at a loss.


'This script is copyright 2004 by Tash Hepting
'Permission is granted to use and distribute ONLY on the official DMGenie website and
'the Genie's Lamp Yahoo group. Other online forums must contact me for
'permission before distributing. This copyright notice must be included in
'any distribution on an online forum. Janik Zikovsky is granted full rights to this code
'for incorporation into DMGenie/PCGenie, and does not have to include the copyright
'notice if this code is distributed in DMGenie or PCGenie.


'version 1.0.0


'Initialize some variables and objects
durationDie = ""
damageDie=""
Dim objRegEx, Match, Matches
Set objRegEx = New RegExp


'Set some RegExp global variables
'Return all pattern matches, not just the first one
objRegEx.Global = True
'case insensitive comparisons
objRegEx.IgnoreCase = True
'Set the regular expression
objRegEx.Pattern = "Breath Weapon.*:.*\r"


'Evaluate the regular expression and put the matching strings into a collection
Set Matches = objRegEx.Execute(cr.Desc)


'If the regexp matched, lets start processing it.
if Matches.Count > 0 then
'Get the results, and put them into a new string to be matched against
NewString = Matches.Item(0)
'Set a new regular expression - one word on each side of a die-roll
objRegEx.Pattern = "\S+\s*[0-9]+d[0-9]+\s*\S+"
'create the collection of matches
Set Matches = objRegEx.Execute(NewString)
'process each match.
For Each Match in Matches
if (inStr(1, Match.value, "round", VBTextCompare) > 0) then
objRegEx.Pattern = "\d+d\d+"
Set dieRollSearch = objRegEx.Execute(Match.value)
if dieRollSearch.Count > 0 then durationDie = dieRollSearch.Item(0)
elseif (inStr(1, Match.value, "damage", VBTextCompare) > 0) then
objRegEx.Pattern = "\d+d\d+"
Set dieRollSearch = objRegEx.Execute(Match.value)
if dieRollSearch.Count > 0 then damageDie = dieRollSearch.Item(0)
end if
Next
if durationDie <> "" then
duration = func.RollDice(durationDie)
'increase duration by 1 because DMGenie removes the counter at the start of the creature's turn.
duration = duration + 1
'Add a Counter at the end of the counters list, or use the existing one.
looper = 0
While ((cr.CounterName(looper) <> "" and cr.Countername(looper) <> "Breath Weapon Exhausted"))
looper = looper + 1
Wend
if cr.CounterExp(looper) > 0 then
res = msgBox(cr.Name & " hasn't recovered from the last breath weapon yet, are you sure you want to do this?", 4)
if res = 6 then
'Set the Counter name and expiration
cr.CounterName(looper) = "Breath Weapon Exhausted"
cr.CounterExp(looper) = duration
cr.CounterExpRd(looper) = duration + cr.Round
func.AddToCombatLog "\b1" & cr.Name & " \b0 uses it's Breath Weapon for \b1 " & damageDie & " \b0 hitpoints of damage."
end if
else
'Set the Counter name and expiration
cr.CounterName(looper) = "Breath Weapon Exhausted"
cr.CounterExp(looper) = duration
cr.CounterExpRd(looper) = duration + cr.Round
func.AddToCombatLog "\b1" & cr.Name & " \b0 uses it's Breath Weapon for \b1 " & damageDie & " \b0 hitpoints of damage."
end if
else
func.AddToCombatLog "No understandable duration found in the Breath Weapons description."
end if
else
func.AddToCombatLog "No Breath Weapon found in the creature's description"
end if

tussock

unread,
May 6, 2015, 10:31:13 PM5/6/15
to
vampiregoat69 wrote:

> I am using a script for breath weapon counter and I can't figure out WTF
> I need to set in the description for it to understand it.The creature I
> want has a 7d8 damage from fire and I wanted it 1d4 rounds.I tried to
> use the syntex it uses to put the damage and rounds in the description
> only for it to tell me NOPE.
>
> I copied Breath Weapon.*:.*\r into the description and tried 7d8.1d4\r
> and I am at a loss.

It's a regular expression, a text-parsing command language. "\r" is
the "new line" special character so it'll read and parse the whole
line, .* is any amount of text and numbers until the following character
is found.

So the code searches for the text "damage" near a dice expression,
and the text "round" near another dice expression, separated by ":", and
terminated by a new line.

Breath Weapon deals 7d8 damage : reusable after 1d4 rounds.

Though I'm out of practice and can't test that, but it's something
like that. <code snipped, see op>

--
tussock
0 new messages