Xeen Wiki
Advertisement
Supported In:
C D/S/W W-CD
? ? ?

The scripting command TakeOrGive has the opcode (0x1C).

Arguments

  • Byte - Give Type
  • Byte - Compare Value (1, 2, or 4 bytes, depending on type, mostly 1)
  • Byte - Give Type
  • Byte - Give Value (1, 2, or 4 bytes, depending on type, mostly 1)


Description

Compares the value of the type in the first argument, and gives the thing in the second argument only if true.

Notes

Behaves similar to the 0x0C TakeOrGive except the "take" argument is replaced with the comparison. For example

00: 1c 4d 00 4d 14 // if temp AC <= 0, give +20 AC

Checks temp armour (0x4D), and if it is 0, sets it to 0x14 (20). Has the same effect as performing an If followed by a 0x0C TakeOrGive, and can be rewritten as

00: 09 4d 00 02    // if temp AC == 0, goto 2
01: 12             // else, exit
02: 0c 00 00 4d 14 // give +20 AC

This is only used for the well in Newcastle after it has been reconstructed. The check is superfluous because it performs the If fix mentioned above, and then performs the comparison anyway.

While 0x0C, 0x1C, 0x1D, and 0x26 opcodes all execute the TakeGive command, there are differences which may warrant each to have their own page.

Advertisement