CassowaryConstrain(cassowary, string, float)

From NWN Lexicon
Revision as of 01:19, 14 March 2021 by Jasperre (talk | contribs) (Created page with "{{DISPLAYTITLE:CassowaryConstrain(cassowary, string, float)}}__NOTOC__ Add a constraint to a cassowary. <nwscript> cassowary CassowaryConstrain( cassowary cSolver, str...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Add a constraint to a cassowary.

cassowary CassowaryConstrain(
    cassowary cSolver,
    string sConstraint,
    float fStrength = CASSOWARY_STRENGTH_REQUIRED
);

Parameters

cSolver
The cassowary to constrain
sConstraint
A constraint for the solver
fStrength
The strength of this constraint. It can be a float value between CASSOWARY_STRENGTH_WEAK (1.0) and CASSOWARY_STRENGTH_REQUIRED (1001001000.0). (default: CASSOWARY_STRENGTH_REQUIRED)

Description

Add a constraint to the system.

The constraint needs to be a valid comparison equation, one of: >=, ==, <=.

This implementation is a linear constraint solver.

You cannot multiply or divide variables and expressions with each other. Doing so will result in a error when attempting to add the constraint. (You can, of course, multiply or divide by constants).

fStrength must be >= CASSOWARY_STRENGTH_WEAK && <= CASSOWARY_STRENGTH_REQUIRED.

Any referenced variables can be retrieved with CassowaryGetValue.

Returns "" on success, or the parser/constraint system error message.


Remarks

If you're not sure what a cassowary is, it's not the bird but instead a type of solver. NWN uses them internally to resize the newer GUI windows. You can use them to do solving by inputting data in, and ask it to give you data out.


Version

This function was added in 1.83.8193.21 of NWN:EE.


Example

See Also

functions:

GetLocalCassowary, SetLocalCassowary, DeleteLocalCassowary, CassowaryConstrain, CassowarySuggestValue, CassowaryGetValue, CassowaryDebug

constants:

CASSOWARY_STRENGTH_*