Well, the reason you use the code tags is to preserve indentation. Using indentation is an excellent way to keep code neat, readable, and can actually help you catch errors.
Here's your code with indentation and some clean-up of the spacing (i.e. returns added or removed for readability) (I've changed nothing else at this point, this will function identically to your original)
SCN AAPrepareCorpseShort SoulButtonShort CheckShort ChoiceBegin ScriptEffectStart Set Choice to -1EndBegin ScriptEffectUpdate ; This will always fire. If ( Choice == -1 && GetItemCount AASoulStopper == 0 && GetDead == 1 ) Set SoulButton to GetButtonPressed Messagebox "What would you like to do?", "Capture the soul.", "Nothing." Set choice to 1 Endif ; This will NEVER show up for some reason. EVER If (Choice == -1 && GetItemCount AASoulStopper == 1 && GetDead == 1) Messagebox "You've already captured this victims soul" Set choice to 2 Endif ;This doesn't happen the first time I cast the spell, although if i Cast the spell again it will happen. If (choice == 1 && SoulButton == 0 ) additem AASoulStopper 1 player.additem BlackSoulGemFilled 1 Set SoulButton to GetButtonPressed Set Choice to -1 Messagebox "You've captured your vitcims soul." ; Even if you select Nothing from the messagebox - this never shows up either. It doesn't matter if you ; select nothing the first time and cast the spell again. It just doesn't show up. Elseif (Choice == 1 && SoulButton == 1 ) Messagebox "You leave your victims corpse alone for now and attend to other matters." Set choice to -1 Set SoulButton to -1 Endif ; if the first box fires and you decide to steal the soul, this message box will pop up the second time ; you cast the spell on the same corpse - and curiously, your black soulgem is added at the same time. If (Choice == 2) Messagebox "What would you like to do?" EndifEndBegin ScriptEffectFinishEnd
The first thing I see is an empty ScriptEffectFinish block; you don't need that. Second, you could probably speed this up a bit by using elseif more instead of separate blocks. Nested ifs could also help. Here's a first pass through with those changes:
SCN AAPrepareCorpseShort SoulButtonShort CheckShort ChoiceBegin ScriptEffectStart Set Choice to -1EndBegin ScriptEffectUpdate ; This will always fire. If ( Choice == -1 && GetDead ) ; without == 1 here, it will be the same as != 0 If ( GetItemCount AASoulStopper == 0 ) Set SoulButton to GetButtonPressed Messagebox "What would you like to do?", "Capture the soul.", "Nothing." Set Choice to 1 Else Messagebox "You've already captured this victim's soul." ; "victim's" is the possessive Set Choice to 2 Endif ;This doesn't happen the first time I cast the spell, although if i Cast the spell again it will happen. Elseif ( Choice == 1 ) If ( SoulButton == 0 ) additem AASoulStopper 1 player.additem BlackSoulGemFilled 1 Set SoulButton to GetButtonPressed Set Choice to -1 Messagebox "You've captured your vitcim's soul." ; Even if you select Nothing from the messagebox - this never shows up either. It doesn't matter if you ; select nothing the first time and cast the spell again. It just doesn't show up. Elseif ( SoulButton == 1 ) Messagebox "You leave your victims corpse alone for now and attend to other matters." Set Choice to -1 Set SoulButton to -1 Endif ; if the first box fires and you decide to steal the soul, this message box will pop up the second time ; you cast the spell on the same corpse - and curiously, your black soulgem is added at the same time. Elseif ( Choice == 2) Messagebox "What would you like to do?" EndifEnd
These changes, again, shouldn't affect the functioning of your script (other than making it run a bit faster and make its function a bit clearer because mutually exclusive options are within if/elseif/else blocks).
Anyway, now that it's cleaned up and I can read it more easily, I think I see the problem (or at least a problem) - you're calling GetButtonPressed before the MessageBox. That doesn't work. You need to call MessageBox, and then have a separate block while the script is waiting for input with GetButtonPressed. As is, GetButtonPressed will
always return -1 (player doesn't even have buttons yet to press!), and then it doesn't get called again. I recommend http://cs.elderscrolls.com/constwiki/index.php/MessageBox_Tutorial for using the MessageBox; it's quite thorough (read: long), but working with MessageBoxes is a bit tricky, so that's generally a good thing.
In general, MessageBox/GetButtonPressed work... awkwardly in script effects. Because of the limited duration on the script, if the player takes too long to answer, the script may stop running before he does - that's not good. I recommend changing this so you have a Quest script that handles the MessageBox and adding/removing the items, and the script effect just sets that Quest script running by passing the reference of the target to the Quest script. Something like this:
scn MagicEffectScriptBegin ScriptEffectScript set Quest.refVar to GetSelf set Quest.fQuestDelayTime to 0.01End
And then:
scn QuestScriptref refVarshort choiceshort checkshort SoulButtonfloat fQuestDelayTimeBegin GameMode if ( refVar ) ; MessageBox and related code. set refVar to 0 set fQuestDelayTime to 0 endifEnd
fQuestDelayTime controls how often a Quest script is run. During the MessageBox time, you want it to be running every frame, so it's set to 0.01, but otherwise it's set to 0 so the script will use the default (once every ~5 seconds). You could alternatively use StartQuest/StopQuest or whatever those functions are called, but I didn't feel like looking up exactly how they work for such a miniscule performance boost.