Jump to content


Photo

Fear the Logic...OR ELSE.


  • Please log in to reply
3 replies to this topic

#1 Vivian

Vivian
  • Member
  • 18 posts

Posted 30 November 2010 - 11:56 AM

Okay, here's my question in as simple a format as I can put it...

IN BALDUR'S GATE II...

I'm trying to create a catch-all/opposite statement for the check...
IF ~InParty("Person") !Dead("Person")~


...thus, I need to check if "Person" is not in the party OR if "Person" is in party AND dead, which would lead me to believe it's something like

IF ~OR(2) !InParty("Person") [combined check of InParty("Person") AND Dead("Person")]~

Since there's no AND() blocks, I'm not entirely sure what to do...I've gone through every combination I can think of where I only use that OR statement and rearrange the other statements (since without an OR it is an implied AND), yet I can't seem to figure it out.

There isn't some hidden, magical blanket "ELSE" statement, is there?

ALSO, even if there's a simple fix to this specific case, I'd like to know how one would go about the logic of this regardless of what actual statements are involved (i.e. how one would code IF (condition) OR (condition AND condition) no matter what the conditions are).

Thanks in advance for any insight!

Edited by Vivian, 30 November 2010 - 11:56 AM.

Name: Vivi
Class: Multi-Class (Coder/Designer/Composer)
Alignment: Chaotic Neutral
Mod Involvement: Miles NPC Mod - Coder

Please Do Not Hit Me
Mages Can Not Take Damage
I Am Too Squishy

-- Haiku from ThinkGeek.com

#2 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 30 November 2010 - 12:27 PM

Just duplicate the blocks.
IF
  InParty("Person")
  Dead("Person")
THEN
  RESPONSE #100
    (actions)
END

IF
  !InParty("Person")
THEN
  RESPONSE #100
    (same actions as above)
END
That's a script example, but you could do the same with dialogue - you'd just have the same dialogue options in both blocks.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#3 the bigg

the bigg

    2083 is a prime number.

  • Modder
  • 3331 posts

Posted 30 November 2010 - 12:28 PM

!(a && !b) = !a || b; in particular, !(InParty("Person") !Dead("Person")) = OR(2) !InParty("Person") Dead("Person")

The scripting language can't express a || (b && c) natively, you need to apply Boolean logic to reduce the expression to Product of Sum form; in this case, a || (b && c) = (a || b) && (a || c). You can automate the Boolean reduction using REFACTOR_*_TRIGGER.

Italian users: help test the Stivan NPC!

Author or Co-Author: WeiDU - Widescreen - Generalized Biffing - Refinements - TB#Tweaks - IWD2Tweaks - TB#Characters - Traify Tool - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics - Nalia Mod - Nvidia Fix
Code dumps: Detect custom secondary types - Stutter Investigator

If possible, send diffs, translations and other contributions using Git.


#4 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 30 November 2010 - 12:41 PM

...

It doesn't matter how clever you make the script lines with the OR(x) command, you'll still end up computing the same amount of script lines, even if it seems that the OR(x) makes it less. So you are better to just do a double check and use the same launcher...

Deactivated account. The user today is known as The Imp.