Scripted Messagebox Problem

Post » Sat Aug 08, 2009 11:12 pm

Let me start by saying that I'm very inexperienced scripter, and that this entire thing is based off of the script for the Improved Ring of Teleportation. The idea of the script is that, once equipped, the ring running the script lets the player summon any combination of 9 daedra. Right now, I've only got the first tier banged out, which you'll find if you have the patience to look though the whole thing, but I figured it would be a good idea to see if the thing actually works at 404 lines of code.

I have two problems at the moment:

- On equipping, instead of the Main Menu, it currently shows Summon Menu 1, e.g. the menu that assumes that the player is summoning a Clannfear. I don't know if it actually will summon one or not, since I can't finish the summoning because:

- Instead of displaying all buttons, I get a small box that shows about 3.5 options, arranged horizontally, with the end buttons just cut off on the sides.

Other notes: Since there's no cancel button (and I couldn't see it if there was) I get stuck in the menu, but removing the ring from my inventory via the console makes the menu disappear after clicking a random option. I'm assuming that that part works fine. Also, I'm not sure if all of the lines preceded by a semicolon are even necessary, because I was too scared to leave out random bits when I'm not sure exactly what they do.

Here's the beast:
Spoiler
Begin RADD_BloodsummonScript

short OnPCEquip
short Button
short ScriptStatus
If ( MenuMode == 1 )
Return
EndIf
If ( OnPCEquip == 1 )
Set ScriptStatus to 10
Endif
If ( ScriptStatus == 0 )
Return
EndIf
If ( ScriptStatus == 10 )
;display Main menu
Messagebox "As you put the ring onto your finger, you feel a harsh power scraqe against your soul. What do you wish to call from Oblivion?", "Clannfear" "Daedroth" "Dremora" "Flame Atronach" "Frost Atronach" "Hunger" "Golden Saint" "Storm Atronach" "Winged Twilight"
Set ScriptStatus to 800
EndIf
If ( Scriptstatus == 800 )
;Check Main menu
If ( button == 0 )
Set ScriptStatus to 11
EndIf
If ( button == 1 )
Set ScriptStatus to 12
EndIf
If ( button == 2 )
Set ScriptStatus to 13
EndIf
If ( button == 3 )
Set ScriptStatus to 14
EndIf
If ( button == 4 )
Set ScriptStatus to 15
EndIf
If ( button == 5 )
Set ScriptStatus to 16
EndIf
If ( button == 6 )
Set ScriptStatus to 17
EndIf
If ( button == 7 )
Set ScriptStatus to 19
EndIf
If ( button == 8 )
Set ScriptStatus to 20
EndIf
EndIf
If ( ScriptStatus == 11 )
;display Summon Menu 1
Messagebox "You call forth a Clannfear from the realm of Oblivion. You can draw further on the ring to summon more:", "Daedroth" "Dremora" "Flame Atronach" "Frost Atronach" "Hunger" "Golden Saint" "Storm Atronach" "Winged Twilight" "That's Enough"
Set ScriptStatus to 801
EndIf
If ( ScriptStatus == 801 )
;Check Summon Menu 1
If ( button == 0 )
Set ScriptStatus to 21
EndIf
If ( button == 1 )
Set ScriptStatus to 22
EndIf
If ( button == 2 )
Set ScriptStatus to 23
EndIf
If ( button == 3 )
Set ScriptStatus to 24
EndIf
If ( button == 4 )
Set ScriptStatus to 25
EndIf
If ( button == 5 )
Set ScriptStatus to 26
EndIf
If ( button == 6 )
Set ScriptStatus to 27
EndIf
If ( button == 7 )
Set ScriptStatus to 28
EndIf
If ( button == 8 )
Set ScriptStatus to 901
EndIf
EndIf
If ( ScriptStatus == 901 )
Player -> Addspell "RADD_Bloodsummon_Clannfear"
EndIf
If ( ScriptStatus == 12)
;display Summon Menu 2
Messagebox "You call forth a Daedroth from the realm of Oblivion. You can draw further on the ring to summon more:", "Clannfear" "Dremora" "Flame Atronach" "Frost Atronach" "Hunger" "Golden Saint" "Storm Atronach" "Winged Twilight" "That's Enough"
Set ScriptStatus to 802
EndIf
If ( ScriptStatus == 802)
;Check Summon Menu 2
If ( button == 0 )
Set ScriptStatus to 29
EndIf
If ( button == 1 )
Set ScriptStatus to 30
EndIf
If ( button == 2 )
Set ScriptStatus to 31
EndIf
If ( button == 3 )
Set ScriptStatus to 32
EndIf
If ( button == 4 )
Set ScriptStatus to 33
EndIf
If ( button == 5 )
Set ScriptStatus to 34
EndIf
If ( button == 6 )
Set ScriptStatus to 35
EndIf
If ( button == 7 )
Set ScriptStatus to 36
EndIf
If ( button == 8 )
Set ScriptStatus to 902
EndIf
EndIf
If ( ScriptStatus == 902 )
Player -> Addspell "RADD_Bloodsummon_Daedroth"
EndIf
If ( ScriptStatus == 13)
;display Summon Menu 3
Messagebox "You call forth a Dremora from the realm of Oblivion. You can draw further on the ring to summon more:", "Clannfear" "Daedroth" "Flame Atronach" "Frost Atronach" "Hunger" "Golden Saint" "Storm Atronach" "Winged Twilight" "That's Enough"
Set ScriptStatus to 803
EndIf
If ( ScriptStatus == 803)
;Check Summon Menu 3
If ( button == 0 )
Set ScriptStatus to 37
EndIf
If ( button == 1 )
Set ScriptStatus to 38
EndIf
If ( button == 2 )
Set ScriptStatus to 39
EndIf
If ( button == 3 )
Set ScriptStatus to 40
EndIf
If ( button == 4 )
Set ScriptStatus to 41
EndIf
If ( button == 5 )
Set ScriptStatus to 42
EndIf
If ( button == 6 )
Set ScriptStatus to 43
EndIf
If ( button == 7 )
Set ScriptStatus to 44
EndIf
If ( button == 8 )
Set ScriptStatus to 903
EndIf
EndIf
If ( ScriptStatus == 903 )
Player -> Addspell "RADD_Bloodsummon_Dremora"
EndIf
If ( ScriptStatus == 14)
;display Summon Menu 4
Messagebox "You call forth a Flame Atronach from the realm of Oblivion. You can draw further on the ring to summon more:", "Clannfear" "Daedroth" "Dremora" "Frost Atronach" "Hunger" "Golden Saint" "Storm Atronach" "Winged Twilight" "That's Enough"
Set ScriptStatus to 804
EndIf
If ( ScriptStatus == 804)
;Check Summon Menu 4
If ( button == 0 )
Set ScriptStatus to 45
EndIf
If ( button == 1 )
Set ScriptStatus to 46
EndIf
If ( button == 2 )
Set ScriptStatus to 47
EndIf
If ( button == 3 )
Set ScriptStatus to 48
EndIf
If ( button == 4 )
Set ScriptStatus to 49
EndIf
If ( button == 5 )
Set ScriptStatus to 50
EndIf
If ( button == 6 )
Set ScriptStatus to 51
EndIf
If ( button == 7 )
Set ScriptStatus to 52
EndIf
If ( button == 8 )
Set ScriptStatus to 904
EndIf
EndIf
If ( ScriptStatus == 904 )
Player -> Addspell "RADD_Bloodsummon_Flame"
EndIf
If ( ScriptStatus == 15)
;display Summon Menu 5
Messagebox "You call forth a Frost Atronach from the realm of Oblivion. You can draw further on the ring to summon more:", "Clannfear" "Daedroth" "Dremora" "Flame Atronach" "Hunger" "Golden Saint" "Storm Atronach" "Winged Twilight" "That's Enough"
Set ScriptStatus to 805
EndIf
If ( ScriptStatus == 805)
;Check Summon Menu 5
If ( button == 0 )
Set ScriptStatus to 53
EndIf
If ( button == 1 )
Set ScriptStatus to 54
EndIf
If ( button == 2 )
Set ScriptStatus to 55
EndIf
If ( button == 3 )
Set ScriptStatus to 56
EndIf
If ( button == 4 )
Set ScriptStatus to 57
EndIf
If ( button == 5 )
Set ScriptStatus to 58
EndIf
If ( button == 6 )
Set ScriptStatus to 59
EndIf
If ( button == 7 )
Set ScriptStatus to 60
EndIf
If ( button == 8 )
Set ScriptStatus to 905
EndIf
EndIf
If ( ScriptStatus == 905 )
Player -> Addspell "RADD_Bloodsummon_Frost"
EndIf
If ( ScriptStatus == 16)
;display Summon Menu 6
Messagebox "You call forth a Hunger from the realm of Oblivion. You can draw further on the ring to summon more:", "Clannfear" "Daedroth" "Dremora" "Flame Atronach" "Frost Atronach" "Golden Saint" "Storm Atronach" "Winged Twilight" "That's Enough"
Set ScriptStatus to 806
EndIf
If ( ScriptStatus == 806)
;Check Summon Menu 6
If ( button == 0 )
Set ScriptStatus to 61
EndIf
If ( button == 1 )
Set ScriptStatus to 62
EndIf
If ( button == 2 )
Set ScriptStatus to 63
EndIf
If ( button == 3 )
Set ScriptStatus to 64
EndIf
If ( button == 4 )
Set ScriptStatus to 65
EndIf
If ( button == 5 )
Set ScriptStatus to 66
EndIf
If ( button == 6 )
Set ScriptStatus to 67
EndIf
If ( button == 7 )
Set ScriptStatus to 68
EndIf
If ( button == 8 )
Set ScriptStatus to 906
EndIf
EndIf
If ( ScriptStatus == 906 )
Player -> Addspell "RADD_Bloodsummon_Hunger"
EndIf
If ( ScriptStatus == 17)
;display Summon Menu 7
Messagebox "You call forth a Golden Saint from the realm of Oblivion. You can draw further on the ring to summon more:", "Clannfear" "Daedroth" "Dremora" "Flame Atronach" "Frost Atronach" "Hunger" "Storm Atronach" "Winged Twilight" "That's Enough"
Set ScriptStatus to 807
EndIf
If ( ScriptStatus == 807)
;Check Summon Menu 7
If ( button == 0 )
Set ScriptStatus to 69
EndIf
If ( button == 1 )
Set ScriptStatus to 70
EndIf
If ( button == 2 )
Set ScriptStatus to 71
EndIf
If ( button == 3 )
Set ScriptStatus to 72
EndIf
If ( button == 4 )
Set ScriptStatus to 73
EndIf
If ( button == 5 )
Set ScriptStatus to 74
EndIf
If ( button == 6 )
Set ScriptStatus to 75
EndIf
If ( button == 7 )
Set ScriptStatus to 76
EndIf
If ( button == 8 )
Set ScriptStatus to 907
EndIf
EndIf
If ( ScriptStatus == 907 )
Player -> Addspell "RADD_Bloodsummon_Saint"
EndIf
If ( ScriptStatus == 19)
;display Summon Menu 9
Messagebox "You call forth a Storm Atronach from the realm of Oblivion. You can draw further on the ring to summon more:", "Clannfear" "Daedroth" "Dremora" "Flame Atronach" "Frost Atronach" "Hunger" "Golden Saint" "Winged Twilight" "That's Enough"
Set ScriptStatus to 808
EndIf
If ( ScriptStatus == 808)
;Check Summon Menu 8
If ( button == 0 )
Set ScriptStatus to 77
EndIf
If ( button == 1 )
Set ScriptStatus to 78
EndIf
If ( button == 2 )
Set ScriptStatus to 79
EndIf
If ( button == 3 )
Set ScriptStatus to 80
EndIf
If ( button == 4 )
Set ScriptStatus to 81
EndIf
If ( button == 5 )
Set ScriptStatus to 82
EndIf
If ( button == 6 )
Set ScriptStatus to 83
EndIf
If ( button == 7 )
Set ScriptStatus to 84
EndIf
If ( button == 8 )
Set ScriptStatus to 908
EndIf
EndIf
If ( ScriptStatus == 908 )
Player -> Addspell "RADD_Bloodsummon_Storm"
EndIf
If ( ScriptStatus == 20)
;display Summon Menu 10
Messagebox "You call forth a Winged Twilight from the realm of Oblivion. You can draw further on the ring to summon more:", "Clannfear" "Daedroth" "Dremora" "Flame Atronach" "Frost Atronach" "Hunger" "Golden Saint" "Storm Atronach" "That's Enough"
Set ScriptStatus to 810
EndIf
If ( ScriptStatus == 810)
;Check Summon Menu 8
If ( button == 0 )
Set ScriptStatus to 85
EndIf
If ( button == 1 )
Set ScriptStatus to 86
EndIf
If ( button == 2 )
Set ScriptStatus to 87
EndIf
If ( button == 3 )
Set ScriptStatus to 88
EndIf
If ( button == 4 )
Set ScriptStatus to 89
EndIf
If ( button == 5 )
Set ScriptStatus to 90
EndIf
If ( button == 6 )
Set ScriptStatus to 91
EndIf
If ( button == 7 )
Set ScriptStatus to 92
EndIf
If ( button == 8 )
Set ScriptStatus to 910
EndIf
EndIf
If ( ScriptStatus == 910 )
Player -> Addspell "RADD_Bloodsummon_Twilight"
EndIf
If ( OnPCEquip == 0 )
Player -> Removespell "RADD_Bloodsummon_Clannfear"
Player -> Removespell "RADD_Bloodsummon_Daedroth"
Player -> Removespell "RADD_Bloodsummon_Dremora"
Player -> Removespell "RADD_Bloodsummon_Flame"
Player -> Removespell "RADD_Bloodsummon_Frost"
Player -> Removespell "RADD_Bloodsummon_Hunger"
Player -> Removespell "RADD_Bloodsummon_Saint"
Player -> Removespell "RADD_Bloodsummon_Storm"
Player -> Removespell "RADD_Bloodsummon_Twilight"
Return
EndIf
End RADD_BloodsummonScript


A preemtive thank-you to anyone who reads through that thing.
User avatar
Chica Cheve
 
Posts: 3411
Joined: Sun Aug 27, 2006 10:42 pm

Post » Sun Aug 09, 2009 12:24 am

One: you should beware of large scripts. There are plenty of limitations on script size, and at least one of them - the amount of ifs - is not reported by compiler in any way and you only notice that it was violated when the script starts to behave erratically in game. I'm pretty sure that you've already broken this one, and you say that it's only one tier... You ought to think of another way of arranging your summonings that doesn't require for multiple repeats of basically the same code. It may not work exactly the way you dream about, but at least it'd work.

Two: if you haven't yet downloaded http://www.tesnexus.com/downloads/file.php?id=13969, do so now. Scripting at large without actually understanding what exactly is that you do isn't a best way to learn.

Three: unfortunately, CS authors didn't make proper debugging tools for it, so the basic procedure I can recommend you is: if something doesn't work as you expect, try to follow the script step by step as it is going to run. Write down all variables that will be checked and/or changed, examine each line of code following the logic of the script and see what that line exactly does and whether it's what you planned it to do.

As for the script itself in the way you presented it - sorry, I just see no point to try to improve it by small changes. Better throw it out the window and start anew. And this time keep it simple.
User avatar
Kelly John
 
Posts: 3413
Joined: Tue Jun 13, 2006 6:40 am

Post » Sun Aug 09, 2009 1:02 pm

I second what Kir said. It is also in many cases to have more smaller scripts.


Also, with programming of any kinds if you find yourself writing the same code again you are doing it incorrectly. While due to the lack of features in Morrowinds scripting language it is harder it still can be done.

For example, this big block of if/else

If ( button == 0 )Set ScriptStatus to 11EndIfIf ( button == 1 )Set ScriptStatus to 12EndIfIf ( button == 2 )Set ScriptStatus to 13EndIfIf ( button == 3 )Set ScriptStatus to 14EndIfIf ( button == 4 )Set ScriptStatus to 15EndIfIf ( button == 5 )Set ScriptStatus to 16EndIfIf ( button == 6 )Set ScriptStatus to 17EndIfIf ( button == 7 )Set ScriptStatus to 19EndIfIf ( button == 8 )Set ScriptStatus to 20EndIf


You be reduced to something like:
set ScriptStatus to button + 11



Ask Kir said you also have a lot of repeated messageboxes which are the same. You should try and avoid doing this.

From your script you could get around it by using a single state for each different messagebox, and when you want to repeat the same messagebox you just set the state back so that it displays the messagebox again. So rather than setting the script status to 13 onwards you could just set it back to 12 to get the same messagebox back again.
User avatar
Mr. Ray
 
Posts: 3459
Joined: Sun Jul 29, 2007 8:08 am

Post » Sun Aug 09, 2009 11:35 am

Thanks a lot to both of you. I'll be reviewing the script and paring down the language. Looks like I won't have to scrap it after all, but I might have to make the summoning interface less "smart".

Edit: I've done an overhaul and changed the basic behavior. Even by closely emulating the teleport ring and example in MWSFD, it's been a chore to even have the first menu show up, which it now does. Unfortunately, it doesn't work, and clicking any button just results in the same menu. I've got a couple repetitive blocks, which were in there when the menu started showing up, and I didn't take them out because I didn't want to jinx anything, seeing how unbelievably picky the first menu is.

Spoiler
Begin RADD_Bloodsummonshort OnPCEquipshort buttonshort ScriptStatusshort SummonClannfearshort SummonDaedrothshort SummonDremorashort SummonFlameshort SummonFrostshort SummonSaintshort SummonStormshort SummonTwilightIf ( MenuMode == 1 )	ReturnEndIfIf ( OnPCEquip == 1 )	Set ScriptStatus to 20EndIfIf ( ScriptStatus == 0 )	ReturnEndIfIf ( ScriptStatus == 20 )	MessageBox "As you put the ring onto your finger, you feel a harsh power scraqe against your soul. What do you wish to call from Oblivion?", "Clannfear" "Daedroth" "Dremora" "Flame Atronach" "Frost Atronach" "Golden Saint" "Storm Atronach" "Winged Twilight" "N-n-nothing"	Set ScriptStatus to 30EndIfIf ( ScriptStatus == 30 )Set button to GetButtonPressed	If ( button == 0 )	Set ScriptStatus to 100	EndIf	If ( button == 1 )	Set ScriptStatus to 101	EndIf	If ( button == 2 )	Set ScriptStatus to 102	EndIf	If ( button == 3 )	Set ScriptStatus to 103	EndIf	If ( button == 4 )	Set ScriptStatus to 104	EndIf	If ( button == 5 )	Set ScriptStatus to 105	EndIf	If ( button == 6 )	Set ScriptStatus to 106	EndIf	If ( button == 7 )	Set ScriptStatus to 107	EndIf	If ( button == 8 )	Set ScriptStatus to 108	EndIfEndIfIf (  ScriptStatus == 100 )	Set SummonClannfear to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 101 )	Set SummonDaedroth to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 102 )	Set SummonDremora to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 103 )	Set SummonFlame to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 104 )	Set SummonFrost to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 105 )	Set SummonSaint to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 106 )	Set SummonStorm to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 107 )	Set SummonTwilight to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 108 )	ReturnEndIfIf ( ScriptStatus == 200 )		MessageBox "You call upon the power of the ring and summon the daedra. What is your desire?", "Clannfear" "Daedroth" "Dremora" "Flame Atronach" "Frost Atronach" "Golden Saint" "Storm Atronach" "Winged Twilight" "Finish Summoning"		Set ScriptStatus to 400EndIfIf ( ScriptStatus == 400)Set button to GetButtonPressed	If ( button == 0 )	Set ScriptStatus to 400	EndIf	If ( button == 1 )	Set ScriptStatus to 401	EndIf	If ( button == 2 )	Set ScriptStatus to 402	EndIf	If ( button == 3 )	Set ScriptStatus to 403	EndIf	If ( button == 4 )	Set ScriptStatus to 404	EndIf	If ( button == 5 )	Set ScriptStatus to 405	EndIf	If ( button == 6 )	Set ScriptStatus to 406	EndIf	If ( button == 7 )	Set ScriptStatus to 407	EndIf	If ( button == 8 )	Set ScriptStatus to 408	EndIfEndIfIf ( ScriptStatus == 400 )	Set SummonClannfear to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 401 )	Set SummonDaedroth to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 402 )	Set SummonDremora to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 403 )	Set SummonFlame to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 404 )	Set SummonFrost to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 405 )	Set SummonSaint to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 406 )	Set SummonStorm to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 407 )	Set SummonTwilight to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 408 )	If ( SummonClannfear == 1 )	Player -> Addspell "RADD_Bloodsummon_Clannfear"	EndIf	If ( SummonDaedroth == 1 )	Player -> Addspell "RADD_Bloodsummon_Daedroth"	EndIf	If ( SummonFlame == 1 )	Player -> Addspell "RADD_Bloodsummon_Flame"	EndIf	If ( SummonFrost == 1 )	Player -> Addspell "RADD_Bloodsummon_Frost"	EndIf	If ( SummonSaint == 1 )	Player -> Addspell "RADD_Bloodsummon_Saint"	EndIf	If ( SummonStorm == 1 )	Player -> Addspell "RADD_Bloodsummon_Storm"	EndIf	If ( SummonTwilight == 1 )	Player -> Addspell "RADD_Bloodsummon_Twilight"	EndIfSet ScriptStatus to 0EndIfIf ( OnPCEquip == 0 )	Player -> Removespell "RADD_Bloodsummon_Clannfear"	Player -> Removespell "RADD_Bloodsummon_Daedroth"	Player -> Removespell "RADD_Bloodsummon_Dremora"	Player -> Removespell "RADD_Bloodsummon_Flame"	Player -> Removespell "RADD_Bloodsummon_Frost"	Player -> Removespell "RADD_Bloodsummon_Saint"	Player -> Removespell "RADD_Bloodsummon_Storm"	Player -> Removespell "RADD_Bloodsummon_Twilight"	ReturnEndIfEnd RADD_Bloodsummon

User avatar
Kerri Lee
 
Posts: 3404
Joined: Sun Feb 25, 2007 9:37 pm

Post » Sun Aug 09, 2009 12:11 pm

First mistake: you place "If ( ScriptStatus == 0 )" check above the "Set ScriptStatus to 20", which makes it impossible the check to ever match.

Second mistake: You never actually set "button" value. Edit your code like this:
Spoiler
Begin RADD_Bloodsummonshort OnPCEquipshort Buttonshort ScriptStatusshort SummonClannfearshort SummonDaedrothshort SummonDremorashort SummonFlameshort SummonFrostshort SummonSaintshort SummonStormshort SummonTwilightIf ( MenuMode == 1 )	ReturnEndIfIf ( ScriptStatus == 0 )	ReturnEndIfIf ( OnPCEquip == 1 )	;display Main menu		Messagebox "As you put the ring onto your finger, you feel a harsh power scraqe against your soul. What do you wish to call from Oblivion?", "Clannfear" "Daedroth" "Dremora" "Flame Atronach" "Frost Atronach" "Golden Saint" "Storm Atronach" "Winged Twilight" "N-n-nothing"	Set ScriptStatus to 20EndIfIf ( ScriptStatus == 20 )	;Check Main menu	Set button to GetButtonPressed		; <=== Add this	Set ScriptStatus to 100 + buttonEndIfIf ( ScriptStatus == 100 )	Set SummonClannfear to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 101 )	Set SummonDaedroth to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 102 )	Set SummonDremora to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 103 )	Set SummonFlame to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 104 )	Set SummonFrost to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 105 )	Set SummonSaint to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 106 )	Set SummonStorm to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 107 )	Set SummonTwilight to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 108 )	Set ScriptStatus to 0		; <== Avoid the eternal loop	ReturnEndIfIf ( ScriptStatus == 200 )	;display Menu 2		Messagebox "You call upon the power of the ring and summon the daedra. What is your desire?", "Clannfear" "Daedroth" "Dremora" "Flame Atronach" "Frost Atronach" "Golden Saint" "Storm Atronach" "Winged Twilight" "Finish Summoning"	Set ScriptStatus to 300EndIfIf ( ScriptStatus == 300 )	;Check Menu 2	Set button to GetButtonPressed		; <=== Add this	Set ScriptStatus to 400 + buttonEndIfIf ( ScriptStatus == 400 )	Set SummonClannfear to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 401 )	Set SummonDaedroth to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 402 )	Set SummonDremora to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 403 )	Set SummonFlame to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 404 )	Set SummonFrost to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 405 )	Set SummonSaint to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 406 )	Set SummonStorm to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 407 )	Set SummonTwilight to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 408 )	If ( SummonClannfear == 1 )	Player -> Addspell "RADD_Bloodsummon_Clannfear"	EndIf	If ( SummonDaedroth == 1 )	Player -> Addspell "RADD_Bloodsummon_Daedroth"	EndIf	If ( SummonFlame == 1 )	Player -> Addspell "RADD_Bloodsummon_Flame"	EndIf	If ( SummonFrost == 1 )	Player -> Addspell "RADD_Bloodsummon_Frost"	EndIf	If ( SummonSaint == 1 )	Player -> Addspell "RADD_Bloodsummon_Saint"	EndIf	If ( SummonStorm == 1 )	Player -> Addspell "RADD_Bloodsummon_Storm"	EndIf	If ( SummonTwilight == 1 )	Player -> Addspell "RADD_Bloodsummon_Twilight"	EndIfSet ScriptStatus to 0EndIfIf ( OnPCEquip == 0 )	Player -> Removespell "RADD_Bloodsummon_Clannfear"	Player -> Removespell "RADD_Bloodsummon_Daedroth"	Player -> Removespell "RADD_Bloodsummon_Dremora"	Player -> Removespell "RADD_Bloodsummon_Flame"	Player -> Removespell "RADD_Bloodsummon_Frost"	Player -> Removespell "RADD_Bloodsummon_Saint"	Player -> Removespell "RADD_Bloodsummon_Storm"	Player -> Removespell "RADD_Bloodsummon_Twilight"	ReturnEndIfEnd RADD_Bloodsummon

Everything after semicolon is just comments added to the code for better understanding. The compiler ignores them.

Also: are you sure that Addspell "RADD_Bloodsummon_XXX" is enough for what you plan it to do? In its normal state, it's not; I've heard about "Scripted spells" mod that uses some advanced technique, but somehow I doubt that you're doing the same thing.
User avatar
Jah Allen
 
Posts: 3444
Joined: Wed Jan 24, 2007 2:09 am

Post » Sun Aug 09, 2009 5:58 am

Again, thanks very much for the help. Funnily enough, though (in the sense that 'funny' means 'horribly unfunny'), equipping the ring with the script copied directly from that post results in nothing happening. Setting ScriptStatus and then displaying the menu based off of that, rather than displaying it directly, is the only thing that has displayed either menu, broken or unbroken, and I have no idea why. I might have to end up sidelining that script in search of projects that aren't cursed by the gods.

Also, using the addspell and removespell commands with the console worked perfectly, which is a small consolation. And a lot of fun in Balmora, especially given that they sap the "caster's" health.
User avatar
Brooke Turner
 
Posts: 3319
Joined: Wed Nov 01, 2006 11:13 am

Post » Sun Aug 09, 2009 9:06 am

[chuckle] I copypasted the script from your post and forgot to apply my own advice. Also, since you most probably equip the ring from inventory - and therefore while being in menu mode - the check blocks script's running. Try it like this:
Spoiler
Begin RADD_Bloodsummonshort OnPCEquipshort Buttonshort ScriptStatusshort SummonClannfearshort SummonDaedrothshort SummonDremorashort SummonFlameshort SummonFrostshort SummonSaintshort SummonStormshort SummonTwilightif ( OnPCEquip == 1 )	Set ScriptStatus to 10EndIfIf ( MenuMode == 1 )	ReturnEndIfIf ( ScriptStatus == 0 )	ReturnEndIfIf ( ScriptStatus == 10 )	;display Main menu		Messagebox "As you put the ring onto your finger, you feel a harsh power scraqe against your soul. What do you wish to call from Oblivion?", "Clannfear" "Daedroth" "Dremora" "Flame Atronach" "Frost Atronach" "Golden Saint" "Storm Atronach" "Winged Twilight" "N-n-nothing"	Set ScriptStatus to 20EndIfIIf ( ScriptStatus == 20 )	;Check Main menu	Set button to GetButtonPressed		; <=== Add this	Set ScriptStatus to 100 + buttonEndIfIf ( ScriptStatus == 100 )	Set SummonClannfear to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 101 )	Set SummonDaedroth to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 102 )	Set SummonDremora to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 103 )	Set SummonFlame to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 104 )	Set SummonFrost to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 105 )	Set SummonSaint to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 106 )	Set SummonStorm to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 107 )	Set SummonTwilight to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 108 )	Set ScriptStatus to 0		; <== Avoid the eternal loop	ReturnEndIfIf ( ScriptStatus == 200 )	;display Menu 2		Messagebox "You call upon the power of the ring and summon the daedra. What is your desire?", "Clannfear" "Daedroth" "Dremora" "Flame Atronach" "Frost Atronach" "Golden Saint" "Storm Atronach" "Winged Twilight" "Finish Summoning"	Set ScriptStatus to 300EndIfIf ( ScriptStatus == 300 )	;Check Menu 2	Set button to GetButtonPressed		; <=== Add this	Set ScriptStatus to 400 + buttonEndIfIf ( ScriptStatus == 400 )	Set SummonClannfear to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 401 )	Set SummonDaedroth to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 402 )	Set SummonDremora to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 403 )	Set SummonFlame to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 404 )	Set SummonFrost to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 405 )	Set SummonSaint to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 406 )	Set SummonStorm to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 407 )	Set SummonTwilight to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 408 )	If ( SummonClannfear == 1 )	Player -> Addspell "RADD_Bloodsummon_Clannfear"	EndIf	If ( SummonDaedroth == 1 )	Player -> Addspell "RADD_Bloodsummon_Daedroth"	EndIf	If ( SummonFlame == 1 )	Player -> Addspell "RADD_Bloodsummon_Flame"	EndIf	If ( SummonFrost == 1 )	Player -> Addspell "RADD_Bloodsummon_Frost"	EndIf	If ( SummonSaint == 1 )	Player -> Addspell "RADD_Bloodsummon_Saint"	EndIf	If ( SummonStorm == 1 )	Player -> Addspell "RADD_Bloodsummon_Storm"	EndIf	If ( SummonTwilight == 1 )	Player -> Addspell "RADD_Bloodsummon_Twilight"	EndIfSet ScriptStatus to 0EndIfIf ( OnPCEquip == 0 )	Player -> Removespell "RADD_Bloodsummon_Clannfear"	Player -> Removespell "RADD_Bloodsummon_Daedroth"	Player -> Removespell "RADD_Bloodsummon_Dremora"	Player -> Removespell "RADD_Bloodsummon_Flame"	Player -> Removespell "RADD_Bloodsummon_Frost"	Player -> Removespell "RADD_Bloodsummon_Saint"	Player -> Removespell "RADD_Bloodsummon_Storm"	Player -> Removespell "RADD_Bloodsummon_Twilight"	ReturnEndIfEnd RADD_Bloodsummon

When you wear the ring from inventory, nothing should happen, but when you leave it, the first menu should show.
User avatar
Isabel Ruiz
 
Posts: 3447
Joined: Sat Nov 04, 2006 4:39 am

Post » Sun Aug 09, 2009 12:43 pm

Again, the posted script doesn't work, and the problem seems to lie in getting a proper response from button. I've spent a good hour (or, rather, a bad hour) toying with it, and here's a (not really) brief summary of my attempts. Since the script seems to stop functioning just after the Main Menu, I decide to see if some random bit of quirkiness in Morrowind's coding is processing the script weirdly by putting in the messagebox "It works!" for the Clannfear option.

Spoiler
Begin RADD_Bloodsummonshort OnPCEquipshort Buttonshort ScriptStatusshort SummonClannfearshort SummonDaedrothshort SummonDremorashort SummonFlameshort SummonFrostshort SummonSaintshort SummonStormshort SummonTwilightif ( OnPCEquip == 1 )	Set ScriptStatus to 10EndIfIf ( MenuMode == 1 )	ReturnEndIfIf ( ScriptStatus == 0 )	ReturnEndIfIf ( ScriptStatus == 10 )	;display Main menu		Messagebox "As you put the ring onto your finger, you feel a harsh power scraqe against your soul. What do you wish to call from Oblivion?", "Clannfear" "Daedroth" "Dremora" "Flame Atronach" "Frost Atronach" "Golden Saint" "Storm Atronach" "Winged Twilight" "N-n-nothing"	Set ScriptStatus to 20EndIfIf ( ScriptStatus == 20 )	;Check Main menu	Set button to GetButtonPressed	Set ScriptStatus to 100 + buttonEndIfIf ( ScriptStatus == 100 )	Messagebox "It works!"	Set SummonClannfear to 1	Set ScriptStatus to 200EndIf


Unfortunately, the quirkiness idea seems to be the case - Now, clicking any option displays the messagebox "It works!" at the bottom of the screen, while returning to the main menu. This is bizarre, since it seems that ScriptStatus is at both 20 and 100 at the same time, which shouldn't be possible. I go back to my ignorant roots and try the magical solution of doing things the long way again:

Spoiler
Begin RADD_Bloodsummonshort OnPCEquipshort Buttonshort ScriptStatusshort SummonClannfearshort SummonDaedrothshort SummonDremorashort SummonFlameshort SummonFrostshort SummonSaintshort SummonStormshort SummonTwilightif ( OnPCEquip == 1 )	Set ScriptStatus to 10EndIfIf ( MenuMode == 1 )	ReturnEndIfIf ( ScriptStatus == 0 )	ReturnEndIfIf ( ScriptStatus == 10 )	;display Main menu		Messagebox "As you put the ring onto your finger, you feel a harsh power scraqe against your soul. What do you wish to call from Oblivion?", "Clannfear" "Daedroth" "Dremora" "Flame Atronach" "Frost Atronach" "Golden Saint" "Storm Atronach" "Winged Twilight" "N-n-nothing"	Set ScriptStatus to 20EndIfIf ( ScriptStatus == 20 )	;Check Main menu	Set button to GetButtonPressed	If ( button == 0 )	Set ScriptStatus to 100	EndIf	If ( button == 1 )	Set ScriptStatus to 101	EndIf	If ( button == 2 )	Set ScriptStatus to 102	EndIf	If ( button == 3 )	Set ScriptStatus to 103	EndIf	If ( button == 4 )	Set ScriptStatus to 104	EndIf	If ( button == 5 )	Set ScriptStatus to 105	EndIf	If ( button == 6 )	Set ScriptStatus to 106	EndIf	If ( button == 7 )	Set ScriptStatus to 107	EndIf	If ( button == 8 )	Set ScriptStatus to 108	EndIfEndIfIf ( ScriptStatus == 100 )	Messagebox "It works!"EndIf


No dice. Absolutely no change in functionality is seen, which I suppose I should've seen coming, but if anything, this thing has taught me not to assume things work. I pull out my ace-in-the-hole voodoo ritual of shortening the menu so it fits on one line without scrolling to the right in the CS.

Spoiler
If ( ScriptStatus == 10 )	;display Main menu		Messagebox "As you put the ring onto your finger, you feel a harsh power scraqe against your soul. What do you wish to call from Oblivion?", "Clannfear" "Daedroth" "Dremora" "Flame Atronach" "Frost Atronach" "Golden Saint" "Storm Atronach" "Winged Twilight" "Nothing"	Set ScriptStatus to 20EndIfIf ( ScriptStatus == 20 )	;Check Main menu	If ( button == 0 )	Set ScriptStatus to 100	EndIf	If ( button == 1 )	Set ScriptStatus to 101	EndIf	If ( button == 2 )	Set ScriptStatus to 102	EndIf	If ( button == 3 )	Set ScriptStatus to 103	EndIf	If ( button == 4 )	Set ScriptStatus to 104	EndIf	If ( button == 5 )	Set ScriptStatus to 105	EndIf	If ( button == 6 )	Set ScriptStatus to 106	EndIf	If ( button == 7 )	Set ScriptStatus to 107	EndIf	If ( button == 8 )	Set ScriptStatus to 108	EndIfEndIfIf ( ScriptStatus == 100 )	Messagebox "It works!"EndIf



No response again. Thinking back to ScriptStatus and its 20-100 duality (now under research at CERN laboratories), I wondered if it was simply executing the menu more times than it should. I try modifying the code for the first menu like this:

Spoiler
Begin RADD_Bloodsummonshort OnPCEquipshort Buttonshort doOnceshort ScriptStatusshort SummonClannfearshort SummonDaedrothshort SummonDremorashort SummonFlameshort SummonFrostshort SummonSaintshort SummonStormshort SummonTwilightif ( OnPCEquip == 1 )	Set ScriptStatus to 10	Set doOnce to 0EndIfIf ( MenuMode == 1 )	ReturnEndIfIf ( ScriptStatus == 0 )	ReturnEndIfIf ( doOnce == 0 )	If ( ScriptStatus == 10 )		;display Main menu			Messagebox "As you put the ring onto your finger, you feel a harsh power scraqe against your soul. What do you wish to call from Oblivion?", "Clannfear" "Daedroth" "Dremora" "Flame Atronach" "Frost Atronach" "Golden Saint" "Storm Atronach" "Winged Twilight" "Nothing"		Set ScriptStatus to 20	EndIf	Set doOnce to 1EndIf


Things get even weirder. Now simply equipping the ring displays both the menu and the messagebox "It works!", while still showing both the messagebox and menu if I click any option. ScriptStatus has apparently mutated, presenting itself as 10, 20, and 100 at the same time. Further research may reveal ScriptStatus to be the elusive "string" that string theorists say pervades the entire universe and more. In a last-ditch effort before moving my attention elsewhere so as to keep my sanity, I remember to put the GetButtonPressed lines back in. This resulted in the disappearance of "It works!", even when clicking on Clannfear, but no other change. In other words, this puts me precisely where I started again in terms of script functionality. The script as it stands:

Spoiler
Begin RADD_Bloodsummonshort OnPCEquipshort Buttonshort doOnceshort ScriptStatusshort SummonClannfearshort SummonDaedrothshort SummonDremorashort SummonFlameshort SummonFrostshort SummonSaintshort SummonStormshort SummonTwilightif ( OnPCEquip == 1 )	Set ScriptStatus to 10	Set doOnce to 0EndIfIf ( MenuMode == 1 )	ReturnEndIfIf ( ScriptStatus == 0 )	ReturnEndIfIf ( doOnce == 0 )	If ( ScriptStatus == 10 )		;display Main menu			Messagebox "As you put the ring onto your finger, you feel a harsh power scraqe against your soul. What do you wish to call from Oblivion?", "Clannfear" "Daedroth" "Dremora" "Flame Atronach" "Frost Atronach" "Golden Saint" "Storm Atronach" "Winged Twilight" "Nothing"		Set ScriptStatus to 20	EndIf	Set doOnce to 1EndIfIf ( ScriptStatus == 20 )	;Check Main menu	Set button to GetButtonPressed	If ( button == 0 )	Set ScriptStatus to 100	EndIf	If ( button == 1 )	Set ScriptStatus to 101	EndIf	If ( button == 2 )	Set ScriptStatus to 102	EndIf	If ( button == 3 )	Set ScriptStatus to 103	EndIf	If ( button == 4 )	Set ScriptStatus to 104	EndIf	If ( button == 5 )	Set ScriptStatus to 105	EndIf	If ( button == 6 )	Set ScriptStatus to 106	EndIf	If ( button == 7 )	Set ScriptStatus to 107	EndIf	If ( button == 8 )	Set ScriptStatus to 108	EndIfEndIfIf ( ScriptStatus == 100 )	Messagebox "It works!"EndIfIf ( ScriptStatus == 101 )	Set SummonDaedroth to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 102 )	Set SummonDremora to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 103 )	Set SummonFlame to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 104 )	Set SummonFrost to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 105 )	Set SummonSaint to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 106 )	Set SummonStorm to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 107 )	Set SummonTwilight to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 108 )	Set ScriptStatus to 0	ReturnEndIfIf ( ScriptStatus == 200 )	;display Menu 2		Messagebox "You call upon the power of the ring and summon the daedra. What is your desire?", "Clannfear" "Daedroth" "Dremora" "Flame Atronach" "Frost Atronach" "Golden Saint" "Storm Atronach" "Winged Twilight" "Finish Summoning"	Set ScriptStatus to 300EndIfIf ( ScriptStatus == 300 )	;Check Menu 2	Set button to GetButtonPressed	If ( button == 0 )	Set ScriptStatus to 400	EndIf	If ( button == 1 )	Set ScriptStatus to 401	EndIf	If ( button == 2 )	Set ScriptStatus to 402	EndIf	If ( button == 3 )	Set ScriptStatus to 403	EndIf	If ( button == 4 )	Set ScriptStatus to 404	EndIf	If ( button == 5 )	Set ScriptStatus to 405	EndIf	If ( button == 6 )	Set ScriptStatus to 406	EndIf	If ( button == 7 )	Set ScriptStatus to 407	EndIf	If ( button == 8 )	Set ScriptStatus to 408	EndIfEndIfIf ( ScriptStatus == 400 )	Set SummonClannfear to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 401 )	Set SummonDaedroth to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 402 )	Set SummonDremora to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 403 )	Set SummonFlame to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 404 )	Set SummonFrost to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 405 )	Set SummonSaint to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 406 )	Set SummonStorm to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 407 )	Set SummonTwilight to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 408 )	If ( SummonClannfear == 1 )	Player -> Addspell "RADD_Bloodsummon_Clannfear"	EndIf	If ( SummonDaedroth == 1 )	Player -> Addspell "RADD_Bloodsummon_Daedroth"	EndIf	If ( SummonFlame == 1 )	Player -> Addspell "RADD_Bloodsummon_Flame"	EndIf	If ( SummonFrost == 1 )	Player -> Addspell "RADD_Bloodsummon_Frost"	EndIf	If ( SummonSaint == 1 )	Player -> Addspell "RADD_Bloodsummon_Saint"	EndIf	If ( SummonStorm == 1 )	Player -> Addspell "RADD_Bloodsummon_Storm"	EndIf	If ( SummonTwilight == 1 )	Player -> Addspell "RADD_Bloodsummon_Twilight"	EndIfSet ScriptStatus to 0EndIfIf ( OnPCEquip == 0 )	Player -> Removespell "RADD_Bloodsummon_Clannfear"	Player -> Removespell "RADD_Bloodsummon_Daedroth"	Player -> Removespell "RADD_Bloodsummon_Dremora"	Player -> Removespell "RADD_Bloodsummon_Flame"	Player -> Removespell "RADD_Bloodsummon_Frost"	Player -> Removespell "RADD_Bloodsummon_Saint"	Player -> Removespell "RADD_Bloodsummon_Storm"	Player -> Removespell "RADD_Bloodsummon_Twilight"	ReturnEndIfEnd RADD_Bloodsummon


In the very likely event that the culprit is an overlooked syntactical error, please don't hesitate to point it out. At this point, however, my position in soliciting more involved assistance is less of a clueless noob wanting a quick fix than an invitation to war (from a less-clueless noob) as I wrestle with this thing until Ragnarok.
User avatar
Scarlet Devil
 
Posts: 3410
Joined: Wed Aug 16, 2006 6:31 pm

Post » Sat Aug 08, 2009 11:39 pm

OK, newbie scripter will give his advice. haha Did you try to to change all those if and endif to ifs and elseifs. Don't know if it makes a different or puts another monkey wrench in yr script, but i would try that. Like for this part.

Spoiler
If ( ScriptStatus == 20 )	;Check Main menu	Set button to GetButtonPressed	If ( button == 0 )	Set ScriptStatus to 100	elseIf ( button == 1 )	Set ScriptStatus to 101		elseIf ( button == 2 )	Set ScriptStatus to 102		elseIf ( button == 3 )	Set ScriptStatus to 103	elseIf ( button == 4 )	Set ScriptStatus to 104		elseIf ( button == 5 )	Set ScriptStatus to 105		elseIf ( button == 6 )	Set ScriptStatus to 106		elseIf ( button == 7 )	Set ScriptStatus to 107		elseIf ( button == 8 )	Set ScriptStatus to 108	EndIfEndIf



It's really good practice. I can remember when i first started doing scripts all i did was ifs and endifs and it seemed to make scripts do strange things. When you do elseif the script knows that if all previous elseifs or the first if isn't true then go down the line until one is true. Instead of just doing if end if end if end the script seems like its getting pulled in eight different directions its like yr telling it hey go this way! No go this way! No go that way! and its like wtf where you want me to go. I don't know if that makes any sense...i'm probably going to just confuse you more. errrr
User avatar
Lalla Vu
 
Posts: 3411
Joined: Wed Jul 19, 2006 9:40 am

Post » Sun Aug 09, 2009 11:01 am

Unfortunately, the quirkiness idea seems to be the case - Now, clicking any option displays the messagebox "It works!" at the bottom of the screen, while returning to the main menu. This is bizarre, since it seems that ScriptStatus is at both 20 and 100 at the same time, which shouldn't be possible
On the contrary. You just didn't grok Morrowind scripting mechanics :D. Morrowind script runs every frame, from start to finish (that is, "Return" may interrupt it sooner, but next frame it will start again). "Set button to GetButtonPressed" doesn't freeze the script until a button is pressed. Each frame that the button is *not* pressed, GetButtonPressed returns -1 and the script proceeds further.

There was also a mistake I overlooked: since OnPCEquip is a variable that only resets automatically when the ring is unequipped, ScriptStatus gets reset to 10 each turn.

The final version of the script:
Spoiler
Begin RADD_Bloodsummonshort OnPCEquipshort Buttonshort ScriptStatusshort SummonClannfearshort SummonDaedrothshort SummonDremorashort SummonFlameshort SummonFrostshort SummonSaintshort SummonStormshort SummonTwilightif ( OnPCEquip == 1 )	If ( ScriptStatus == 0 )		Set ScriptStatus to 10	endifEndIfIf ( MenuMode == 1 )	ReturnEndIfIf ( ScriptStatus == 0 )	ReturnEndIfIf ( ScriptStatus == 10 )	;display Main menu	Messagebox "As you put the ring onto your finger, you feel a harsh power scraqe against your soul. What do you wish to call from Oblivion?", "Clannfear" "Daedroth" "Dremora" "Flame Atronach" "Frost Atronach" "Golden Saint" "Storm Atronach" "Winged Twilight" "N-n-nothing"	Set ScriptStatus to 20EndIfIf ( ScriptStatus == 20 )	;Check Main menu	Set button to GetButtonPressed	if ( button == -1 )		return	endif	Set ScriptStatus to 100 + buttonEndIfIf ( ScriptStatus == 100 )	Set SummonClannfear to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 101 )	Set SummonDaedroth to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 102 )	Set SummonDremora to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 103 )	Set SummonFlame to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 104 )	Set SummonFrost to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 105 )	Set SummonSaint to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 106 )	Set SummonStorm to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 107 )	Set SummonTwilight to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 108 )	Set ScriptStatus to 0	ReturnEndIfIf ( ScriptStatus == 200 )	;display Menu 2		Messagebox "You call upon the power of the ring and summon the daedra. What is your desire?", "Clannfear" "Daedroth" "Dremora" "Flame Atronach" "Frost Atronach" "Golden Saint" "Storm Atronach" "Winged Twilight" "Finish Summoning"	Set ScriptStatus to 300EndIfIf ( ScriptStatus == 300 )	;Check Menu 2	Set button to GetButtonPressed	if ( button == -1 )		return	endif	Set ScriptStatus to 400 + buttonEndIfIf ( ScriptStatus == 400 )	Set SummonClannfear to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 401 )	Set SummonDaedroth to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 402 )	Set SummonDremora to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 403 )	Set SummonFlame to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 404 )	Set SummonFrost to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 405 )	Set SummonSaint to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 406 )	Set SummonStorm to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 407 )	Set SummonTwilight to 1	Set ScriptStatus to 200EndIfIf ( ScriptStatus == 408 )	If ( SummonClannfear == 1 )		Player -> Addspell "RADD_Bloodsummon_Clannfear"	EndIf	If ( SummonDaedroth == 1 )		Player -> Addspell "RADD_Bloodsummon_Daedroth"	EndIf	If ( SummonDremora == 1 )		Player -> Addspell "RADD_Bloodsummon_Dremora"	EndIf	If ( SummonFlame == 1 )		Player -> Addspell "RADD_Bloodsummon_Flame"	EndIf	If ( SummonFrost == 1 )		Player -> Addspell "RADD_Bloodsummon_Frost"	EndIf	If ( SummonSaint == 1 )		Player -> Addspell "RADD_Bloodsummon_Saint"	EndIf	If ( SummonStorm == 1 )		Player -> Addspell "RADD_Bloodsummon_Storm"	EndIf	If ( SummonTwilight == 1 )		Player -> Addspell "RADD_Bloodsummon_Twilight"	EndIf	Set ScriptStatus to 500EndIfIf ( OnPCEquip == 0 )	If ( ScriptStatus == 500 )		Player -> Removespell "RADD_Bloodsummon_Clannfear"		Player -> Removespell "RADD_Bloodsummon_Daedroth"		Player -> Removespell "RADD_Bloodsummon_Dremora"		Player -> Removespell "RADD_Bloodsummon_Flame"		Player -> Removespell "RADD_Bloodsummon_Frost"		Player -> Removespell "RADD_Bloodsummon_Saint"		Player -> Removespell "RADD_Bloodsummon_Storm"		Player -> Removespell "RADD_Bloodsummon_Twilight"		Return		Set ScriptStatus to 0	endifEndIfEnd RADD_Bloodsummon

User avatar
matt oneil
 
Posts: 3383
Joined: Tue Oct 09, 2007 12:54 am

Post » Sun Aug 09, 2009 12:58 pm

It finally works, hallelujah!

Unsurprisingly, there were still a couple errors, which I (surprisingly) was able to fix easily. Thanks again for imparting your knowledge, though I think I can skive off the big learning experiences for a while. I might be forced to call this thing the Ring of Kir...
User avatar
Nathan Hunter
 
Posts: 3464
Joined: Sun Apr 29, 2007 9:58 am


Return to III - Morrowind