Take slot meseta
From Unofficial QEdit Wiki Guide
Syntax: take_slot_meseta register1, register2
- register1 = Register to store initial amount of meseta to compare with meseta to be taken.
- register2 = Register to act as the check if player has already had meseta taken.
00000000 = Meseta not taken.
00000001 = Meseta has been taken.
Used to take meseta from the players inventory. Also sets a register when the meseta has been taken.
100: jmpi_= R4, 00000001, 102 //If register 4 equals 1 jump to function 102. get_slotnumber R250 //Gets the slot number of the players and stores it in register 250. message 00000118, Hi I am here to rob you! //Makes character id 280 say a message. leti R1, 000001F4 //Makes register 1 equal 000001F4. (500 dec.) let R2, R1 //Makes register 2 equal to register 1. get_slot_meseta R2 //Stores the amount of meseta in the players inventory in register 2. jmp_< R2, R1, 101 //If the value of register 2 is less then the value of register 1 jump to function 101. sync //Waits 1 frame. let R2, R250 //Makes register 2 equal to the value of register 250. let R3, R1 //Makes register 3 equal the value of register 1. clear R4 //Makes register 4 equal 00000000. take_slot_meseta R2, R4 //Register 2 is player to take meseta from it also compares with register 3 amount of meseta to take. As long as register 2 value when it held meseta is equal to or greater then the value of register 3 the meseta will be taken, and register 4 will equal 00000001.(Register 1 above is the amount of meseta that will be taken 500 dec.) add_msg You have been robbed!<cr>Thank you. //Makes character id 280 say the next message. mesend //Closes the message. ret 101: message 00000118, You don't have enough meseta.<cr>I will just rob<cr>someone else. //Makes character id 280 say a message. mesend //Closes the message. ret 102: message 00000118, I already robbed you.<cr>Be on your way. //Makes character id 280 say a message. mesend //Closes the message. ret