Fujiwara said:Various bitwise operations:
val_shift_left (val_shift_left,>dest>,<n places>) : dest = dest << n
val_shift_right : dest = dest >> n
store_and (store_and,<dest>,<op1>,<op2>) : dest = op1 & op2
store_or : dest = op1 | op2
store_xor : dest = op1 ^ op2
store_not : (store_not,<dest>,<op1>) : dest = ~op1
This would make the implementation of bitfields for custom flags much cleaner and less bug-prone
val_or = 2114 #dest, operand :: dest = dest | operand
# (val_or,<destination>,<value>),
val_and = 2115 #dest, operand :: dest = dest & operand
# (val_and,<destination>,<value>),
store_or = 2116 #dest, op1, op2 : dest = op1 | op2
# (store_or,<destination>,<value>,<value>),
store_and = 2117 #dest, op1, op2 : dest = op1 & op2
# (store_or,<destination>,<value>,<value>),
troop_sort_inventory = 1511 # (troop_sort_inventory,<troop_id>),
Fujiwara said:Code:val_or = 2114 #dest, operand :: dest = dest | operand # (val_or,<destination>,<value>), val_and = 2115 #dest, operand :: dest = dest & operand # (val_and,<destination>,<value>), store_or = 2116 #dest, op1, op2 : dest = op1 | op2 # (store_or,<destination>,<value>,<value>), store_and = 2117 #dest, op1, op2 : dest = op1 & op2 # (store_or,<destination>,<value>,<value>),
(assign, ":1or2", 1),
(val_or, ":1or2", 2),
(try_begin),
(eq, ":1or2", 1),
(display_message, "@PASS!"),
(else_try),
(display_message, "@FAIL!"),
(try_end),
(try_begin),
(eq, ":1or2", 2),
(display_message, "@PASS!"),
(else_try),
(display_message, "@FAIL!"),
(try_end),
(try_begin),
(eq, ":1or2", 3),
(display_message, "@PASS!"),
(else_try), :lol:
(display_message, "@FAIL!"),
(try_end),
Looks like it is really not just logic, as I thought at first, but bitwise operation as Fujiwara wanted.dstemmer said:and got FAIL FAIL PASS when I would expect PASS PASS FAIL.
Rongar said:Looks like it is really not just logic, as I thought at first, but bitwise operation as Fujiwara wanted.dstemmer said:and got FAIL FAIL PASS when I would expect PASS PASS FAIL.
In binary 1=01, 2=10, 3=11
So
01 | 10 = 11 = 3
I guess they can be useful to work with item's modifiers.grailknighthero said:Just out of curiosity, what use do we have for bitwise functions? Allows us to mess around with header file hex code more?
Bismarck said:The new version is out!
Let's mod the **** out of this game.
Anyone know, yet?Miclee said:Wooo! Armagan, what's the max amount of troops this thing can hold, now? Is it 1500+?