Reply to Re: Killing magic and items commands broken. (Fixes inside)
If you don't have an account, just leave the password field blank.
My previous self overlooked an even simpler fix, using "set_callback_random()"
Fix used for kill_cur_item(), and can be altered to work with kill_cur_magic:
And the issue of `kill_this_magic()` also making the item image vansih in the status bar and sometimes leaving behind the magic charge bar, which only happens if the magic it's killing off is equipped, is fixed like this:
Fix used for kill_cur_item(), and can be altered to work with kill_cur_magic:
void main(void) { //set a callback to the 'killscript()' proc, with a wait time of 1. //so after we run the flawed 'kill_cur_item()' function, it immediately runs 'killscript()' set_callback_random("killscript", 1, 1); //flawed 'kill_cur_item()' function - will stop the current script executing kill_cur_item(); } void killscript(void) { //this will run immediately after 'kill_cur_item()' //draw the status to make the item image vanish properly draw_status(); //kill off this script so it doesn't remain in memory. kill_this_task(); }
And the issue of `kill_this_magic()` also making the item image vansih in the status bar and sometimes leaving behind the magic charge bar, which only happens if the magic it's killing off is equipped, is fixed like this:
void main(void) { //store '&cur_weapon' in a local variable int &fix_weap = &cur_weapon; //kill fireball kill_this_magic("item-fb"); //fix unwanted side effects with magic charge bar and empty slot staying equipped &cur_magic = 0; &magic_cost = 0; &magic_level = 0 arm_magic(); //restore &cur_weapon, arm it, and draw the status &cur_weapon = &fix_weap; arm_weapon(); draw_status(); }