Message Box confusion

Post » Wed Jun 20, 2012 4:29 am

My problem: I display a multi-option message box when the player activates the object. The options work properly, but the number of clicks needed is being incremented. So I can press option 1 once, but then I must option 2 twice, option 3 three times, and option 4 four times in order for them to respond.

Spoiler
scriptName doomTKGuardianShrineScript extends ObjectReferenceimport gameimport utilityString property graphVariable auto; //which stone are weBOOL PROPERTY bMage AUTOBOOL PROPERTY bThief AUTOBOOL PROPERTY bWarrior AUTO; //list of the effectsSPELL PROPERTY pDoomMageAbility AUTOSPELL PROPERTY pDoomThiefAbility AUTOSPELL PROPERTY pDoomWarriorAbility AUTOSPELL PROPERTY pDoomMageAbility2 AUTOSPELL PROPERTY pDoomThiefAbility2 AUTOSPELL PROPERTY pDoomWarriorAbility2 AUTOSPELL PROPERTY pDoomMageAbility3 AUTOSPELL PROPERTY pDoomThiefAbility3 AUTOSPELL PROPERTY pDoomWarriorAbility3 AUTO; //list of the messagesMESSAGE PROPERTY pDoomMageMSG AUTOMESSAGE PROPERTY pDoomThiefMSG AUTOMESSAGE PROPERTY pDoomWarriorMSG AUTOMESSAGE PROPERTY pDoomCannotTakeGuardianMSG AUTO; //the already have messageMESSAGE PROPERTY pDoomAlreadyHaveMSG AUTO;************************************BOOL DOONCE=TRUEAuto State base        EVENT onACTIVATE(OBJECTREFERENCE obj)                ; //check to see if the player is the activator and we havent already activated        IF(doOnce && obj AS ACTOR == game.getPlayer())                        doOnce = FALSE                        ; //if we already have the power and this is the stone then kick the player out            ; //if the player's stone selection is not a Charge of their guardian, kick him out            ; //if the player has already selected a Guardian and tries to take another, kick him out            ; //finally, disallow player interaction altogether if he has taken the Serpent            IF(bMage && game.getPlayer().hasSpell(pDoomMageAbility))                pDoomAlreadyHaveMSG.show()                utility.wait(2)                                doOnce = TRUE            ELSEIF(bThief && game.getPlayer().hasSpell(pDoomThiefAbility))                pDoomAlreadyHaveMSG.show()                utility.wait(2)                                doOnce = TRUE            ELSEIF(bWarrior && game.getPlayer().hasSpell(pDoomWarriorAbility))                pDoomAlreadyHaveMSG.show()                utility.wait(2)                                doOnce = TRUE            ELSEIF(bMage && (game.getPlayer().hasSpell(pDoomThiefAbility) || game.getPlayer().hasSpell(pDoomWarriorAbility)))                pDoomCannotTakeGuardianMSG.Show()                utility.wait(2)                                doOnce = TRUE            ELSEIF(bThief && (game.getPlayer().hasSpell(pDoomMageAbility) || game.getPlayer().hasSpell(pDoomWarriorAbility)))                pDoomCannotTakeGuardianMSG.Show()                utility.wait(2)                                doOnce = TRUE            ELSEIF(bWarrior && (game.getPlayer().hasSpell(pDoomMageAbility) || game.getPlayer().hasSpell(pDoomThiefAbility)))                pDoomCannotTakeGuardianMSG.Show()                utility.wait(2)                                doOnce = TRUE            ELSE                                    ; // present them with the choice                ; // Items 1, 2, 3 == Accept, Item 4 == Decline                IF(showSign() == 0)                    addSign1()                                        SELF.playAnimation("playanim01")                                        utility.wait(15)                                        doOnce = TRUE                                    ELSEIF(showSign() == 1)                    addSign2()                                        SELF.playAnimation("playanim01")                                        utility.wait(15)                                        doOnce = TRUE                                    ELSEIF(showSign() == 2)                    addSign3()                                        SELF.playAnimation("playanim01")                                        utility.wait(15)                                        doOnce = TRUE                                    ELSE                    utility.wait(2)                    doOnce = TRUE                ENDIF                        ENDIF                    ENDIF    endEVENT    endState; // Shows the sign confirmation message dialogue.int FUNCTION showSign()        int signHolder        IF(bMage)        signHolder = pDoomMageMSG.show()                 ELSEIF(bThief)        signHolder = pDoomThiefMSG.show()    ELSEIF(bWarrior)        signHolder = pDoomWarriorMSG.show()    ENDIF        RETURN signHolder        endFUNCTION; //FUNCTION: addSign; //; // adds the sign of the stone to the playerFUNCTION addSign1()    game.AddAchievement(29)    ; // Standard signs    IF(bMage)        game.getPlayer().addSpell(pDoomMageAbility)    ELSEIF(bThief)        game.getPlayer().addSpell(pDoomThiefAbility)    ELSEIF(bWarrior)        game.getPlayer().addSpell(pDoomWarriorAbility)    ENDIF    endFUNCTION    FUNCTION addSign2()    game.AddAchievement(29)    ; // Standard signs    IF(bMage)        game.getPlayer().addSpell(pDoomMageAbility2)    ELSEIF(bThief)        game.getPlayer().addSpell(pDoomThiefAbility2)    ELSEIF(bWarrior)        game.getPlayer().addSpell(pDoomWarriorAbility2)    ENDIF    endFUNCTION    FUNCTION addSign3()    game.AddAchievement(29)    ; // Standard signs    IF(bMage)        game.getPlayer().addSpell(pDoomMageAbility3)    ELSEIF(bThief)        game.getPlayer().addSpell(pDoomThiefAbility3)    ELSEIF(bWarrior)        game.getPlayer().addSpell(pDoomWarriorAbility3)    ENDIF    endFUNCTION;************************************State waiting    ;do nothingendState;************************************
User avatar
Veronica Flores
 
Posts: 3308
Joined: Mon Sep 11, 2006 5:26 pm

Post » Wed Jun 20, 2012 3:39 am

About these if statements:

IF(showSign() == 0);;;ESLEIF(showSign() == 1);;;ESLEIF(showSign() == 2);;;

Wouldn't that cause you to show a lot menus? I mean, the ShowSign() function in the conditional will cause a messagebox to be shown no matter what. So your script comes to your first if statement, and it has to show a messagebox in order to see whether or not you choose option 0. If you didn't choose option 0, it will have to go to the elseif statement and show another messagebox in order to see if you choose option 1, etc.
User avatar
Vicky Keeler
 
Posts: 3427
Joined: Wed Aug 23, 2006 3:03 am

Post » Wed Jun 20, 2012 1:30 pm

You'll have to do something like
int choice = showSign()if(choice == 0);;;elseif(choice == 1);;;
And so on.
User avatar
Big mike
 
Posts: 3423
Joined: Fri Sep 21, 2007 6:38 pm


Return to V - Skyrim