PanzerOfGod Posted August 21, 2007 Share Posted August 21, 2007 My latest mod has the player drawing tarot cards from a deck with the use of a message box. Here is the script on the full deck: Scriptname SMCTarotDeckScript Short Button Short Button2 Begin OnDrop MessageBox "This item cannot be dropped, only bought, sold, stored, or destroyed. Would you like to destroy this deck?", "Destroy deck.", "Keep deck." Set Button to GetButtonPressed If Button == 0 Disable RemoveMe Message "Deck destroyed." ElseIf Button == 1 Return EndIf End Begin OnSell SMCFortuneTellerRef If Player.GetItemCount SMCTarotDeckTest >= 1 || Player.GetItemCount SMCTarotDeckTestNoDeath >= 1 || Player.GetItemCount SMCTarotDeckOneEye >= 1 MessageBox "You already have a basic deck of tarot cards." Return EndIf End Begin OnEquip MessageBox "This basic deck contains one Death tarot and two Eye tarots. What would you like to do?", "Remove all tarots.", "Remove one Death tarot.", "Remove one Eye tarot.", "Nothing." Set Button2 to GetButtonPressed If Button2 == 0 Player.AddItem SMCDeathTarotWeaponTest 1 Player.AddItem SMCEyeTarotWeaponTest 2 Message "The deck is now empty." Disable RemoveMe Player.AddItem SMCTarotDeckEmpty 1 ElseIf Button2 == 1 Player.AddItem SMCDeathTarotWeaponTest 1 Disable RemoveMe Player.AddItem SMCTarotDeckTestNoDeath 1 ElseIf Button2 == 2 Player.AddItem SMCEyeTarotWeaponTest 1 Disable RemoveMe Player.AddItem SMCTarotDeckTestOneEye 1 ElseIf Button2 == 3 Return EndIf End Before I had realized that I needed to use "Set <whatever> to GetButtonPressed", all the options were happening at once. Now that I'm using that, though, nothing happens when I press any of the buttons. If you need any clarification, just ask. Link to comment Share on other sites More sharing options...
Vagrant0 Posted August 21, 2007 Share Posted August 21, 2007 Really hate how codeboxes stretch the screen, and screws up the code when you try to implant it back in the message... Anyway, the script needs to check for what buttons were pressed within a seperate block from when they were declared. Usually within a gamemode block. Use an additional condition to make the button detection only run when one has been declared, and then clear that condition when the action has been taken. While detecton can technically be done within the same block as declaration, you would need to have conditionals which would block a second declaration, and have to initiate the block a second time. With message boxes, you should probably considder "set button to getbuttonpressed" as a return statment to avoid issues. IEScriptname SMCTarotDeckScript Short Button Short Button2 short once Begin OnDrop MessageBox "This item cannot be dropped, only bought, sold, stored, or destroyed. Would you like to destroy this deck?", "Destroy deck.", "Keep deck." set once to 1 Set Button to GetButtonPressed end begin gamemode if once == 1 If Button == 0 set once to 0 Disable Message "Deck destroyed." RemoveMe ElseIf Button == 1 set once to 0 Return EndIf End Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.