Messagebox loop...

Post » Sat May 28, 2011 3:11 pm

Hey,

it is about a half your age when i last modded somthing, (and i know i'm not good at it) but i wanted to mod somthing again and i ran into an annoying problem.
I want to make a script that asks the player what his favourite school is, the messagebox appears, and everything works fine, but when i click one of the buttons the menu closes(as it should be)... , but then it comes back :(.
I think my problem is somewhere whit the
set button to GetButtonPressed
part.

Can anyone check my script and see what is wrong whit it, cuz i think i have a fun idea :celebration:

Here is my script:
ScriptName 3plusWOTWQuestSCRIPTShort choosingShort button Begin GameMode	Set choosing to -1	Setstage 3plusWOWTQuest 10End Begin GameMode If ( choosing == -1 )	if (GetStage 3plusWOWTQuest == 10)		MessageBox "What is your favourite magic school?", "Alchemy", "Alteration", "Conjuration", "Destruction", "Illusion", "Mysticism", "Restoration" 		Set choosing to 1		set button to GetButtonPressed	EndifElseIf (Choosing == 1) 		If ( button == 0 );Alchemy			setstage 3plusWOWTQuest 1			Set choosing to 2		ElseIf ( button == 1);alteration			setstage 3plusWOWTQuest 2			Set choosing to 2		ElseIf ( button == 2 );Conjuration			setstage 3plusWOWTQuest 3			Set choosing to 2		ElseIf ( button == 3 );Destruction			setstage 3plusWOWTQuest 4 			Set choosing to 2		ElseIf ( button == 4 );Illlusion			setstage 3plusWOWTQuest 5			Set choosing to 2		ElseIf ( button == 5 );Mystticism			setstage 3plusWOWTQuest 6 			Set choosing to 2		ElseIf ( button == 6 );Restoration			setstage 3plusWOWTQuest 7			Set choosing to 2		Endif	EndIf EndIf End


Thanks for looking
Fire3lf aka Triplus
User avatar
Charles Mckinna
 
Posts: 3511
Joined: Mon Nov 12, 2007 6:51 am

Post » Sat May 28, 2011 1:53 pm

Begin GameMode	Set choosing to -1	Setstage 3plusWOWTQuest 10

There's nothing here that is preventing this from running over and over again, so choosing is repeatedly set to -1.

Also, I don't know if it's a good idea to have 2 separate gamemodes running. I don't see the point anyway. Might as well merge them.

How's this:

scn YourScriptNameshort DoOnceshort ChoosingBegin GameMode If DoOnce == 0	Set choosing to -1	Setstage 3plusWOWTQuest 10        Set DoOnce to 1endifIf ( choosing == -1 )	if (GetStage 3plusWOWTQuest == 10)		MessageBox "What is your favourite magic school?", "Alchemy", "Alteration", "Conjuration", "Destruction", "Illusion", "Mysticism", "Restoration" 		Set choosing to 1		set button to GetButtonPressed	EndifElseIf (Choosing == 1) 		If ( button == 0 );Alchemy			setstage 3plusWOWTQuest 1			Set choosing to 2		ElseIf ( button == 1);alteration			setstage 3plusWOWTQuest 2			Set choosing to 2		ElseIf ( button == 2 );Conjuration			setstage 3plusWOWTQuest 3			Set choosing to 2		ElseIf ( button == 3 );Destruction			setstage 3plusWOWTQuest 4 			Set choosing to 2		ElseIf ( button == 4 );Illlusion			setstage 3plusWOWTQuest 5			Set choosing to 2		ElseIf ( button == 5 );Mystticism			setstage 3plusWOWTQuest 6 			Set choosing to 2		ElseIf ( button == 6 );Restoration			setstage 3plusWOWTQuest 7			Set choosing to 2		Endif	EndIf EndIf End

I haven't checked the rest of the script closely but this should fix the problem with the loop.
User avatar
Kanaoka
 
Posts: 3416
Joined: Fri Jun 16, 2006 2:24 pm

Post » Sat May 28, 2011 6:58 am

thanks, i go to try it out :) i let you know somthing
User avatar
Kristina Campbell
 
Posts: 3512
Joined: Sun Oct 15, 2006 7:08 am

Post » Sat May 28, 2011 12:38 pm

The loop is fixed, thank you!

Now when i press the buttons the queststage doesn't change... As i have already said i htink there is somthing worng whit
set button to GetButtonPressed
because nothing happens when i press the buttons :)

Anyone knows what i'm doing wrong ?

ty :)
User avatar
Maria Garcia
 
Posts: 3358
Joined: Sat Jul 01, 2006 6:59 am

Post » Sat May 28, 2011 7:28 am

The loop is fixed, thank you!

Now when i press the buttons the queststage doesn't change... As i have already said i htink there is somthing worng whit
set button to GetButtonPressed
because nothing happens when i press the buttons :)

Anyone knows what i'm doing wrong ?

ty :)

Try removing the "set button" thing, and use this instead:

Spoiler
scn 3plusWOTWQuestSCRIPTshort DoOnceshort ChoosingBegin GameMode If DoOnce == 0	Set choosing to -1	Setstage 3plusWOWTQuest 10        Set DoOnce to 1endifIf ( choosing == -1 )	if (GetStage 3plusWOWTQuest == 10)		MessageBox "What is your favourite magic school?", "Alchemy", "Alteration", "Conjuration", "Destruction", "Illusion", "Mysticism", "Restoration" 		Set choosing to 1	EndifElseIf (Choosing == 1) 		If ( GetButtonPressed == 0 );Alchemy			setstage 3plusWOWTQuest 1			Set choosing to 2		ElseIf ( GetButtonPressed == 1);Alteration			setstage 3plusWOWTQuest 2			Set choosing to 2		ElseIf ( GetButtonPressed == 2 );Conjuration			setstage 3plusWOWTQuest 3			Set choosing to 2		ElseIf ( GetButtonPressed == 3 );Destruction			setstage 3plusWOWTQuest 4 			Set choosing to 2		ElseIf ( GetButtonPressed == 4 );Illusion			setstage 3plusWOWTQuest 5			Set choosing to 2		ElseIf ( GetButtonPressed == 5 );Mysticism			setstage 3plusWOWTQuest 6 			Set choosing to 2		ElseIf ( GetButtonPressed == 6 );Restoration			setstage 3plusWOWTQuest 7			Set choosing to 2		Endif	EndIf End

User avatar
Kate Schofield
 
Posts: 3556
Joined: Mon Sep 18, 2006 11:58 am

Post » Sat May 28, 2011 10:37 am

and my version :
Spoiler

scn YourScriptNameshort DoOnceshort ChoosingBegin GameModeIf DoOnce == 0	Set choosing to -1	Setstage 3plusWOWTQuest 10    Set DoOnce to 1endifif choosing	If ( choosing == -1 )		MessageBox "What is your favourite magic school?", "Alchemy", "Alteration", "Conjuration", "Destruction", "Illusion", "Mysticism", "Restoration"		Set choosing to 1		set button to -1	ElseIf (Choosing == 1)		if button >= 0			If ( button == 0 );Alchemy				setstage 3plusWOWTQuest 1			ElseIf ( button == 1);alteration				setstage 3plusWOWTQuest 2			ElseIf ( button == 2 );Conjuration				setstage 3plusWOWTQuest 3			ElseIf ( button == 3 );Destruction				setstage 3plusWOWTQuest 4			ElseIf ( button == 4 );Illlusion				setstage 3plusWOWTQuest 5			ElseIf ( button == 5 );Mystticism				setstage 3plusWOWTQuest 6			ElseIf ( button == 6 );Restoration				setstage 3plusWOWTQuest 7			Endif			Set choosing to 0		else			set button to GetButtonPressed		endif	EndIfEndIfEndbegin MenuModeset button to getbuttonpressedend

Added a menuMode just in case
CHANGE the name of the quest - NO numbers in the beginning !!!!!!
pov's script was not working cause it only checked once (and early) the buttonpressed - methinks
User avatar
Bethany Short
 
Posts: 3450
Joined: Fri Jul 14, 2006 11:47 am

Post » Sat May 28, 2011 11:00 am

Another flaw I found: You can't go backwards in Quest Stages. The menu is set to execute when the player is at stage 10, but the buttons try to set the stage from to 1-7.
User avatar
Unstoppable Judge
 
Posts: 3337
Joined: Sat Jul 29, 2006 11:22 pm

Post » Sat May 28, 2011 2:28 am

Another flaw I found: You can't go backwards in Quest Stages. The menu is set to execute when the player is at stage 10, but the buttons try to set the stage from to 1-7.

I am not too sure - getStage has this limitation (returns highest stage completed) - setStage should work :shrug:
User avatar
Blaine
 
Posts: 3456
Joined: Wed May 16, 2007 4:24 pm

Post » Sat May 28, 2011 5:32 pm

I made it work i think. But today i don' thave much time left to test it. I hope it will work, but maybe when i find the time i can test more today, else it is in a few days :) but thanks for the help, and when i don't wark i just ask again! thank you all!
User avatar
Chris Cross Cabaret Man
 
Posts: 3301
Joined: Tue Jun 19, 2007 11:33 pm

Post » Sat May 28, 2011 3:47 pm

I'm back :)

Well, only alchemy works... I will put the current script here, i think i took care of everything u guys said :)

Spoiler
ScriptName 3plusWOTWQuestSCRIPTShort choosingShort DoOnce Begin GameModeif (DoOnce ==0)	Set choosing to -1	Setstage AplusWOTWQuest 10	set DoOnce to 1Endif If ( choosing == -1 )	if (GetStage AplusWOTWQuest == 10)		MessageBox "What is your favourite magic school?", "Alchemy", "Alteration", "Conjuration", "Destruction", "Illusion", "Mysticism", "Restoration" 		Set choosing to 1	EndifElseIf (Choosing == 1) 		If ( GetButtonPressed == 0 );Alchemy			setstage AplusWOTWQuest 20			Set choosing to 2		ElseIf ( GetButtonPressed == 1);alteration			setstage AplusWOTWQuest 30			Set choosing to 2		ElseIf ( GetButtonPressed == 2 );Conjuration			setstage AplusWOTWQuest 40			Set choosing to 2		ElseIf ( GetButtonPressed == 3 );Destruction			setstage AplusWOTWQuest 50 			Set choosing to 2		ElseIf ( GetButtonPressed == 4 );Illlusion			setstage AplusWOTWQuest 60			Set choosing to 2		ElseIf ( GetButtonPressed == 5 );Mystticism			setstage AplusWOTWQuest 70 			Set choosing to 2		ElseIf ( GetButtonPressed == 6 );Restoration			setstage AplusWOTWQuest 80			Set choosing to 2		Endif	EndIf EndIf End


Thanks for helping :)
User avatar
BRAD MONTGOMERY
 
Posts: 3354
Joined: Mon Nov 19, 2007 10:43 pm

Post » Sat May 28, 2011 2:57 am

getbuttonpressed returns != -1 only the first time it is called - that's why only alchemy works
use my version -button var very nice & debug friendly- and change the name of the script to not have a number or I will send a Nazgul
:obliviongate:
User avatar
BethanyRhain
 
Posts: 3434
Joined: Wed Oct 11, 2006 9:50 am

Post » Sat May 28, 2011 12:07 pm

It finally works, thank you so much. When i release this mod, i make sure i put you in the credits, it is the least i can do!(however i'm just a noobie modder :D) Thank you, now i can go further whit the rest :)
User avatar
i grind hard
 
Posts: 3463
Joined: Sat Aug 18, 2007 2:58 am


Return to IV - Oblivion