AIgnatiousS Posted March 30, 2018 Share Posted March 30, 2018 Another scripting question, this one should be more simple, but I can't wrap my head around it. I want it to basically say If 'player' activates 'object' Display MessageBox Option 1: Would you like to pick up the object? Option 2: Would you like to destroy the object? Option 1 disables the object, effectively getting rid of it, and then puts a clone of the object (a Misc Item that looks exactly like the Activator) into your inventory. Option 2 disables the object, with no bonus effect other than satisfaction of how evil the player is. Link to comment Share on other sites More sharing options...
AIgnatiousS Posted March 30, 2018 Author Share Posted March 30, 2018 Can anyone find the problem here, I recycled it from an old script with someone having a similiar problem posted in these forums. Problem is it doesn't matter which button I press, it states "You have destroyed the object." I'm not understanding what's wrong. Begin SW_ActivateShort controlvarShort buttonIf ( MenuMode == 1 ) ReturnEndifIf ( OnActivate == 1 ) If ( controlvar == 0 ) MessageBox "What would you like to do with the object?", "Pick it up.", "Destroy it." Set controlvar to 1 elseif controlvar > 1 activate endifendifif ( controlvar == 1 ) set button to GetButtonPressed if ( button == -1 ) return elseif ( button == 2 ) MessageBox "You have picked up the object." Activate set controlvar to 2 else MessageBox "You have destroyed the object." set controlvar to –1 Endifelseif ( controlvar == 2 ) Activate Set controlvar to 3endifEnd Link to comment Share on other sites More sharing options...
ZWolol Posted March 30, 2018 Share Posted March 30, 2018 (edited) Begin SW_Activate Short nState Short nButton if ( MenuMode ) elseif ( nState == 0 ) if ( OnActivate ) MessageBox "What would you like to do with the object?", "Pick it up.", "Destroy it." Set nState to 1 endif elseif ( nState ) Set nButton to GetButtonPressed if ( nButton < 0 ) Return elseif ( nButton == 0 ) MessageBox "You have picked up the object." Activate else MessageBox "You have destroyed the object." Disable endif Set nState to 0 endif End Edited March 31, 2018 by ZWolol Link to comment Share on other sites More sharing options...
john00029 Posted March 30, 2018 Share Posted March 30, 2018 Can anyone find the problem here, I recycled it from an old script with someone having a similiar problem posted in these forums. Problem is it doesn't matter which button I press, it states "You have destroyed the object." I'm not understanding what's wrong. Begin SW_ActivateShort controlvarShort buttonIf ( MenuMode == 1 ) ReturnEndifIf ( OnActivate == 1 ) If ( controlvar == 0 ) MessageBox "What would you like to do with the object?", "Pick it up.", "Destroy it." Set controlvar to 1 elseif controlvar > 1 activate endifendifif ( controlvar == 1 ) set button to GetButtonPressed if ( button == -1 ) return elseif ( button == 2 ) MessageBox "You have picked up the object." Activate set controlvar to 2 else MessageBox "You have destroyed the object." set controlvar to –1 Endifelseif ( controlvar == 2 ) Activate Set controlvar to 3endifEnd GetButtonPressed returns 0 for the first button, 1 for the second button. Therefore it should [elseif ( button == 0 )] not 2. Link to comment Share on other sites More sharing options...
AIgnatiousS Posted April 1, 2018 Author Share Posted April 1, 2018 Okay, I appreciate both of y'all. I ended up going with this one, but I had to change around that button 1 says Destroy it and button 2 says pick it up. It didn't seem right but it worked. Begin SW_Activate Short nStateShort nButton if ( MenuMode )elseif ( nState == 0 ) if ( OnActivate ) MessageBox "What would you like to do with the object?", "Pick it up.", "Destroy it." Set nState to 1 endifelseif ( nState ) Set nButton to GetButtonPressed if ( nButton < 0 ) Return elseif ( nButton == 0 ) MessageBox "You have picked up the object." Activate else MessageBox "You have destroyed the object." Disable endif Set nState to 0endif End Link to comment Share on other sites More sharing options...
Recommended Posts