logical operator documentation

Simulated dice for role playing games
Post Reply
hpavc
Posts: 5
Joined: Mon Aug 16, 2010 4:22 pm
IQ Test: Orange

logical operator documentation

Post by hpavc » Mon Aug 16, 2010 6:21 pm

Hello, I am creating a robust GURPS skill roll macro, I want to "If roll is '6' and skill is >= 16 then auto crit."

Are there logical operators? Otherwise my code balloons significantly, steping through the 3,4 rule, 5,6 rule, 17,18 rule, and the 10 > (@1 - #1) rule.

Code: Select all

elif @1 = 6 && #1 >= 16 then
    @1 + “Auto Critical Success \$Yeah$” + abs(@1 - #1)
Thank you, amazing program!

gandreas
Immortal
Posts: 1464
Joined: Wed Feb 04, 2004 6:02 pm
Contact:

Re: logical operator documentation

Post by gandreas » Tue Aug 17, 2010 2:48 pm

You want ∧ not "&&" for logical and (as well as "maximum"). Similarly, ∨ does logical or (as well as "minimum").

hpavc
Posts: 5
Joined: Mon Aug 16, 2010 4:22 pm
IQ Test: Orange

Re: logical operator documentation

Post by hpavc » Thu Sep 02, 2010 8:48 pm

Thank you, seems to work quite nicely.

Code: Select all

@DICE ← 3d6.
if @DICE = 3 ∨ @DICE = 4 ∨ @DICE = 5 ∧ #1 ≥ 15 ∨ @DICE = 6 ∧ #1 ≥ 16 then
    "\-\-" + @DICE + "\-\gCritical Success\$Yeah$\w" + abs(@DICE - #1)
elif @DICE = 18 ∨ (@1 = 17 ∧ #1 ≤ 15) then
    "\-\-" + @DICE + "\-\rCritical Failure\$Oh$\w" + abs(@DICE - #1)
elif @DICE >= #1 + 10 then
    "\-\-" + @DICE + "\-\rCritical Failure\$Bah$\w" + abs(@DICE - #1)
elif @DICE < #1 then
    "\-\-" + @DICE + "\-\gSuccess by\w" + abs(@DICE - #1)
elif @DICE = #1 then
    "\-\-" + @DICE + "\-\bSuccess\$Hinge$\w" + abs(@DICE - #1)
else
    "\-\-" + @DICE + "\-\yFailed by\w" + abs(@DICE - #1)
end

Post Reply