Test Expressions (searched)

I can't figure out exactly how test expressions work. I know that the main symbols used are |,&,!, and that they somehow evaluate bits, but exactly does each one do? what does 'logical and operator' mean?

------------------
"How many boards would the Mongols hoard if the Mongol hoards got bored."
(url="http://"http://www.EVula.com")why does everybody have an EVula link?(/url)

Quote

Originally posted by Veritus Dartarion:
**I can't figure out exactly how test expressions work. I know that the main symbols used are |, &,!, and that they somehow evaluate bits, but exactly does each one do? what does 'logical and operator' mean?

**

Logical And Operator means simply "and." Perfectly simple. Example: b100 & b300 will set both bits (100 and 300)

However, I'm no wiz at bits, so someone else will have to answer your question in more depth.

------------------
"Wonderful! I'll be a bounder yet!" --Tom Ballard
I /used/ to be sane, but then I got a 5th email address...

Quote

Originally posted by Mantaray:
**Logical And Operator means simply "and." Perfectly simple. Example: b100 & b300 will set both bits (100 and 300)

However, I'm no wiz at bits, so someone else will have to answer your question in more depth.
**

How unusefully complicated.
Do test expressions set bits? Because as I understood it, they just check if bits are set or not.

------------------
"How many boards would the Mongols hoard if the Mongol hoards got bored."
(url="http://"http://www.EVula.com")why does everybody have an EVula link?(/url)

You don't use & for set expressions. You only use it for test. For set, you can use r(b1 b2) and bxxxx{b1 b2}. For test, you have & and | and ( and ).

------------------
Why are you all looking at me like that?

Quote

Originally posted by Sheer_falacy:
**You don't use & for set expressions. You only use it for test. For set, you can use r(b1 b2) and bxxxx{b1 b2}. For test, you have & and | and ( and ).
**

Can't you also use ! for tests? But what do each of the symbols besides the parentheis check for?

------------------
"How many boards would the Mongols hoard if the Mongol hoards got bored."
(url="http://"http://www.EVula.com")why does everybody have an EVula link?(/url)

Oh yeah, ! works.

b1 & b2 checks that both are true.
b1 | b2 checks that at least one is true.
!b1 evaluates to true if b1 is false and false if b1 is true.
I don't know if there is an xor operator. How that would work is this, assuming that it is ^:
b1 ^ b2 would check that exactly one is true (just like | but is false if both are true)

------------------
Why are you all looking at me like that?

a I b check if bit a or bit b is set ( to actually set random bits use the"R" command)
!b clears missions bit b (sets it to false)
a & b set/check both bits
^b sets bit bit b to the opposite of what it was before....

Hope this helps , 🙂

------------------
All your base are belong to us - cats
Never give up , Never surrender --galaxy quest
(url="http://"http://clix.to/iris")Iris Software(EVN:Plugin developers)(/url)
EVN : Invasion

Quote

Originally posted by Sheer_falacy:
**Oh yeah, ! works.

b1 ^ b2 would check that exactly one is true (just like | but is false if both are true)

**

I'm sorry but I guess that isn't true to do that use the I operator.

Correct me if I'm wrong tough...

------------------
All your base are belong to us - cats
Never give up , Never surrender --galaxy quest
(url="http://"http://clix.to/iris")Iris Software(EVN:Plugin developers)(/url)
EVN : Invasion

Quote

Originally posted by Sheer_falacy:
**I don't know if there is an xor operator. How that would work is this, assuming that it is ^:
b1 ^ b2 would check that exactly one is true (just like | but is false if both are true)
**

You can do it with what is given:

!(b1 & b2) <-- check that both aren't true
!(!b1 & !b2) <-- check that both aren't false
!(b1 & b2) & !(!b1 & !b2) <-- put 'em together

or, you could do:

!b1 & b2 <-- checks to see if b1 is clear and b2 is set
b1 & !b2 <-- checks to see if b2 is clear and b1 is set
(!b1 & b2) | (b1 & !b2) <-- if either one is true, then the entire expression evaluates to 1

I don't know for sure if they work in Nova, but I think that the logic works.

------------------
Drugz onli kil teh baad brayn sellz
(url="http://"http://ucplugs.evula.net/")EV/PoG Upcoming Plug-Ins Directory(/url) | (url="http://"http://www.evula.net/")EVula.net(/url) | (url="http://"http://www.evula.com/")EVula.com(/url)
(url="http://"http://www.ev-nova.net/")EV-Nova.net(/url)

Or you could just say:
(b1|b2)&!(b1&b2;)

------------------
Why are you all looking at me like that?

Here you go, straight from the EV:Nova Bible:

Quote

A quick word about control bits and scripting in EV Nova:

Mission bits exist as they did in previous incarnations of EV. This time around,
there are 10,000 bits available for your use, and they are accessed much
differently from previous versions. For this reason, they are referred to as
Nova control bits (ncb's). Control bits are accessed through logical expressions
that allow much more powerful and logical mission scripting. These expressions are
divided into two types - test and set:

Test expressions:

These are boolean expressions that are used to determine when something happens;
for example, when a mission is to be offered, or when a particular ship should
be made available for purchase. In general, if the logical expression defined in
a given test expression field evaluates to be true (nonzero), the associated
property will be activated (mission becomes available, ship appears, etc.).

The following terms and operators are supported: (capitalization doesn't matter)

Bxxx Lookup the value of control bit xxx. Bits are numbered from b0 to b9999.
Pxxx Check if the game is registered ((P)aid for) ... evaluates to 1 if
the game is registered or is unregistered but less than xxx days have
elapsed. Evaluates to 0 only if unregistered for more than xxx days.
G Lookup the player's gender - 1 if male, 0 if female
Oxxx Returns 1 if the player has at least one of outfit item ID xxx, 0 if not
Exxx Returns 1 if the player has explored system ID xxx, 0 if not
| Logical or operator
& Logical and operator
! Logical negation operator
( ) Parenthetical enclosure

Some examples:
b13 & (b15 | !b72)
!(B42 | B53) & b103

Note that since the Nova evaluator is fairly primitive, it may do unpredictable
things if you give it an expression like b1 & b2 | b3 ... instead, use proper
parentheses to make it b1 & (b2 | b3) or (b1 & b2) | b3, as appropriate.

Also note that if you leave the field for a test expression blank, it will
evaluate to true as a default.

Also also note: The Oxxx operator also considers any carried fighters that are
deployed when it examines the player's current list of outfits, although this
feature may be confused if presented with a universe that includes multiple
fighter bay weapons that launch the same ship type, or different outfits that
grant the same fighter bay ammo.

Set expressions:

These are simpler than the test expressions... basically all you are doing here
is listing what bits you want to be modified when the expression in a given
field is invoked. This will happen when the player does something (completes a
mission, buys an item, etc.) as defined by the other resources. The syntax of
set expressions is best illustrated by an example:

b1 b2 !b3 ^b4

In this set expression, bits 1 and 2 will be set, bit 3 will be cleared, and bit
4 will be toggled to the opposite of whatever it was previously. No parentheses
are supported for set expressions. Note that if you leave a set expression
blank, no control bits will be altered.

One other feature of the set expression is the ability to make random decisions.
By specifying R(<op1> <op2> ) you can make Nova randomly pick one of the two
possible choices and execute it, skipping the other one. For example:

b1 R(b2 !b3)

...this expression will set bit 1, and then either set bit 2 or clear bit 3,
but not both at once. Which operation will be picked is completely random, which
allows for the design of interesting mission strings that branch unpredictably.

There are also a number of other operators that allow you to do many interesting
things:

Axxx - if mission ID xxx is currently active, abort it.

Fxxx - if mission ID xxx is currently active, cause it to fail.

Sxxx - start mission ID xxx automatically.

Gxxx - grant one of outfit item ID xxx to the player

Dxxx - remove (Delete) one of outfit item ID xxx from the player

Mxxx - move the player to system xxx. The player will be put on top of the
first stellar in the system, or in the center of the system if no
stellars exist there.

Nxxx - move the player to system xxx. The player will remain at the same
x/y coordinates, relative to the center of the system.

Cxxx - change the player's ship to ship type (ID) xxx. The player will keep all
of his previous outfit items and won't be given any of the default
weapons or items that come with ship type xxx.

Exxx - change the player's ship to ship type (ID) xxx. The player will keep all
of his previous outfit items and will also be given all of the default
weapons and items that come with ship type xxx.

Hxxx - change the player's ship to ship type (ID) xxx. The player will lose any
nonpersistent outfit items he previously had, but will be given all of
the default weapons and items that come with ship type xxx.

Kxxx - activate rank ID xxx.

Lxxx - deactivate rank ID xxx.

Pxxx - play sound with ID xxx.

Yxxx - destroy stellar ID xxx.

Uxxx - regenerate (Un-destroy) stellar ID xxx.

Qxxx - make the player immediately leave (absquatulate) whatever stellar he's
landed on and return to space, and show a message at the bottom of the
screen. The message is randomly selected from the STR# resource with
ID xxx, and is parsed for mission text tags (e.g. <PSN> and <PRK> )
but not text-selection tags like those above (e.g. {G "he" "she"} )
(see dësc and mďsn resource descriptions for more examples)

Txxx - change the name (Title) of the player's ship to a string randomly
selected from STR# resource ID xxx. The previous ship name will be
substituted for any '*' characters which are encountered in the
new string.

Xxxx - make system ID xxx be explored.

------------------
"I've just had an apostrophe!"
"I think you mean an epiphany."
"Lightning has just struck my brain!"
"Well, that must hurt!"

Quote

| Logical or operator
& Logical and operator
! Logical negation operator

This is the only part I don't get, just because I don't know what logical & operator or logical negitation operator mean.

------------------
"How many boards would the Mongols hoard if the Mongol hoards got bored."
(url="http://"http://www.EVula.com")why does everybody have an EVula link?(/url)

Quote

Originally posted by Veritus Dartarion:
**

Quote

| Logical or operator
& Logical and operator
! Logical negation operator

This is the only part I don't get, just because I don't know what logical & operator or logical negitation operator mean.

**

Take this NCB test string: b1 | b2
Logical or operator means that the NCB string will evaluate to true if bit 1 or bit 2 is set.

For this string: b1 & b2
Logical and operator means that this NCB string will evaluate to true if bit 1 and bit 2 are both set.

For this string: !b1 | b2
Logical negation operator means that this will evaluate to true if bit 1 is cleared or bit 2 is set.

Does that make sense?

------------------
"I've just had an apostrophe!"
"I think you mean an epiphany."
"Lightning has just struck my brain!"
"Well, that must hurt!"

Quote

Originally posted by Sheer_falacy:
**Or you could just say:
(b1|b2)&!(b1&b2;)

**

Oh, shut up, you. 😛

------------------
Drugz onli kil teh baad brayn sellz
(url="http://"http://ucplugs.evula.net/")EV/PoG Upcoming Plug-Ins Directory(/url) | (url="http://"http://www.evula.net/")EVula.net(/url) | (url="http://"http://www.evula.com/")EVula.com(/url)
(url="http://"http://www.ev-nova.net/")EV-Nova.net(/url)

Quote

Originally posted by P-Psycho:
**Take this NCB test string: b1 | b2
Logical or operator means that the NCB string will evaluate to true if bit 1 or bit 2 is set.

For this string: b1 & b2
Logical and operator means that this NCB string will evaluate to true if bit 1 and bit 2 are both set.

For this string: !b1 | b2
Logical negation operator means that this will evaluate to true if bit 1 is cleared or bit 2 is set.

Does that make sense?
**

yes it does. I think I got it.

------------------
"How many boards would the Mongols hoard if the Mongol hoards got bored."
(url="http://"http://www.EVula.com")why does everybody have an EVula link?(/url)

Quote

Originally posted by Veritus Dartarion:
**

Quote

Originally posted by P-Psycho:
**Take this NCB test string: b1 | b2
Logical or operator means that the NCB string will evaluate to true if bit 1 or bit 2 is set.

For this string: b1 & b2
Logical and operator means that this NCB string will evaluate to true if bit 1 and bit 2 are both set.

For this string: !b1 | b2
Logical negation operator means that this will evaluate to true if bit 1 is cleared or bit 2 is set.

Does that make sense?
**

yes it does. I think I got it.

**

Just for the record, logical and operator and logical or operator means use the logic definitions of and / or, i.e. treat the arguments as true and false. The other way to use and / or is as bitwise and operator or bitwise or operator, which returns a number based on doing and / or operations on the bits of the numbers. Basically, with that, it compares each bit of one number with the bit of the second using the equivalent of logical and / or operators (i.e. 1 is true and 0 is false), and constructs a third number based on the results of the bitwise comparisons of the two numbers passed as arguments.

------------------
Kevin Ballard
(url="http://"mailto:kevin@sb.org")mailto:kevin@sb.org(/url)kevin@sb.org