Code: Select all
mposet $o value5bits <first_bit_number> <number_of_bits> <value>
mpoadd $o value5bits <first_bit_number> <number_of_bits> <value>
if value5bits(<first_bit_number>,<number_of_bits>,$o) == <value>
Code: Select all
mpmset $n quest <first_bit_number> <number_of_bits> <value>
mpmadd $n quest <first_bit_number> <number_of_bits> <value>
if quest(<first_bit_number>,<number_of_bits>,$n) == <value>
The new commands allow us to slice value5 into several parts. In the example of the ring of spell storing for cure light wounds, levitate and bless, we could use 1 bit to indicate whether or not the cure light wounds charge is available or not, another bit for the levitate charge, and a third bit fot the bless charge. If we number those bits 0, 1, and 2, we can now use the following programs:
Code: Select all
>intercept_prog curelighttrigger~
if wear_loc($o) != -1
if value5bits(0,1,$o) == 1
cast 'cure light' $n
mposet on $n $o value5bits 0 1 0
else
mpechoat $n Nothing happens.
endif
else
mpechoat $n You should wear the ring first.
endif
~
...
>intercept_prog blesstrigger~
if wear_loc($o) != -1
if value5bits(2,1,$o) == 1
cast bless $n
mposet on $n $o value5bits 2 1 0
else
mpechoat $n Nothing happens.
endif
else
mpechoat $n You should wear the ring first.
endif
~
>intercept_prog curelightrecharge~
if wear_loc($o) != -1
if value5bits(0,1,$o) == 1
mpechoat $n The ring does not need to be recharged.
else
if skilllevel($n,cure light) < 6
or manaamt($n) < 40
mpechoat $n That does not work.
else
mpmadd $n currmana -40
mposet on $n $o value5bits 0 1 1
mpechoat $n You recharge the ring.
endif
endif
else
mpechoat $n You should wear the ring first.
endif
~