MtB Posted June 7, 2012 Share Posted June 7, 2012 This script is supposed to allow a character to drink from a water fountain, fill up bottles, or neither of the two. I've tried assorted ways of scripting it and this is the lastest in the line of failures. It always resulted in a perpetual pop up of the "you don't have bottles or caps" message. I know it is something easy, but I can't figure it out. The script... ScriptName aaEBHWaterFountainScript Short ButtonShort DoOnce Begin OnActivate PlayerShowMessage aaEBHWater01MSG ;Would you like to have a drink from the fountain or fill a bottle? Fill/Drink/NeitherEnd Begin GameModeSet Button to GetButtonPressedIf ( Button == 0 ) && ( Player.GetItemCount Caps001 < 1 )ShowMessage aaEBHWater02MSG ;You don't have enough bottles or caps.endif If ( Button == 0 ) && ( Player.GetItemCount SodaBottleEmpty01 < 1 )ShowMessage aaEBHWater02MSG ;You don't have enough bottles or caps.endif If ( Button == 0 ) && ( Player.GetItemCount NukaColaBottle < 1 ) ShowMessage aaEBHWater02MSG ;You don't have enough bottles or caps.endif If ( Button == 0 ) && ( Player.GetItemCount WhiskeyBottle01Empty01 < 1 ) ShowMessage aaEBHWater02MSG ;You don't have enough bottles or caps.endif If ( Button == 0 ) && ( Player.GetItemCount Milkbottle01 < 1 ) ShowMessage aaEBHWater02MSG ;You don't have enough bottles or caps.endif If ( Button == 0 ) && ( Player.GetItemCount SodaBottleEmpty01 >= 1 ) && ( Player.GetItemCount Caps001 >=1 ) Player.RemoveItem SodaBottleEmpty01 1 Player.RemoveItem Caps001 1 Player.AddItem WaterPurified 1 set DoOnce to 0 ElseIf ( Button == 0 ) && ( Player.GetItemCount NukaColaBottle >=1 ) && ( Player.GetItemCount Caps001 >=1 ) Player.RemoveItem NukaColaBottle 1 Player.RemoveItem Caps001 1 Player.AddItem WaterPurified 1 Set DoOnce to 0 ElseIf ( Button == 0 ) && ( Player.GetItemCount WhiskeyBottle01Empty01 >=1 ) && ( Player.GetItemCount Caps001 >=1 ) Player.RemoveItem WhiskeyBottle01Empty01 1 Player.RemoveItem Caps001 1 Player.AddItem WaterPurified 1 Set DoOnce to 0 ElseIf ( Button == 0 ) && ( Player.GetItemCount Milkbottle01 >=1 ) && ( Player.GetItemCount Caps001 >=1 ) Player.RemoveItem Milkbottle01 1 Player.RemoveItem Caps001 1 Player.AddItem WaterPurified 1 Set DoOnce to 0 endif ElseIf ( Button == 1 ) Activate Set DoOnce to 0 ElseIf ( Button == 2 ) ; Do Nothing EndIf End ---------------------------------------- Thanks for any help you can give. MtB Link to comment Share on other sites More sharing options...
MichikoUnknownFox Posted June 7, 2012 Share Posted June 7, 2012 (edited) Try adding this:if Button > -1Before the Button == 0 stuff. Also, you can optimize that to run just one check like this:Set Button to GetButtonPressed if Button > -1 If ( Button == 0 ) if ( Player.GetItemCount Caps001 < 1 ) || ( Player.GetItemCount SodaBottleEmpty01 < 1 ) || ( Player.GetItemCount NukaColaBottle < 1 ) || ( Player.GetItemCount WhiskeyBottle01Empty01 < 1 ) || ( Player.GetItemCount Milkbottle01 < 1 ) ShowMessage aaEBHWater02MSG ;You don't have enough bottles or caps. endif elseif ( Button == 1 ) ; and so on So if any of those triggers, ShowMessage aaEBHWater02MSG will come up when Button 0 is pressed. You need to start with if Button > -1 to tell the game to only show the window while the Button is either 0 or any of the other options (it's -1 while no option is being picked). Oh one more thing. You may want to tell the script that you're on that "page" or that it's still waiting for input. short Page Begin OnActivate Player ShowMessage aaEBHWater01MSG ;Would you like to have a drink from the fountain or fill a bottle? Fill/Drink/Neither set Page to 1 End Begin GameMode If Page == 1 set Page to 0 ; If you want this window to close or stop waiting for input after a button is clicked. set Button to GetButtonPressed if Button > -1 ; and so on Edited June 7, 2012 by HosokawaTakuya Link to comment Share on other sites More sharing options...
Recommended Posts