HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Advanced Dialog Menu Woes

07-12-2004, 11:26 PM#1
BlueSpine
Background
I have recently started working on a project that has full-feature menus when you enter a certain region. The menu has a number of functions, one of which is the purchase of new equipment for your unit if you have the correct upgrades. Thus far, the purchase of speed boosters is available. The clicked dialog path to purchasing level 1 speed boosters is Main Menu -> Market -> Equipment -> Purchase -> Purchase Boosters -> Purchase Level 1 Boosters.

The Dialog Variable itself is MenuDialog(10). There are six triggers in all (the following).

Problem(s)
The first four triggers worked flawlessly, following the correct paths when selected. When the Purchase Boosters (MenuDialog(5)) appears and the upgrade
has not been researched for Speed Boosters, the menu is supposed to restart at the first MenuDialog. However, this does not occur and the next menu appears regardless.

I was able to fix the first problem by making the Purchase Boosters trigger Initially Off and turning it on in the first trigger if the upgrade was researched, which solved the problem.

However, another has occurred. Now when the Purchase Boosters trigger is supposed to appear it no longer appears and simply exits. I cannot find the solution to this problem. I'm absolutely stumped. The following are the triggers, in hope an advanced trigger will notice my folly.


Comments about the triggers will be Lime.



Trigger One: Main Menu Choices
Code:
Events:
	Unit - A Unit enters Station
	[color=Lime]These two Events are for Returning to the Main Menu[/color]
	Dialog - A dialog button is clicked for MenuDialog(4) 
	Dialog - A dialog button is clicked for MenuDialog(6)
Conditions:
Actions:
	Set Station_UnitDocked = (Entering unit)
	If (All Conditions are True) then do (Then Actions) else do (Else Actions)
		If - Conditions:
			Or - Any (Conditions are true)
				Conditions:
					(Clicked dialog button) Equal to ReturntoMain
					(Clicked Dialog button) Equal to ReturntoMain
		Then - Actions:
			Dialog - Clear Menu Dialog(1)
			Dialog - Clear Menu Dialog(2)
			Dialog - Clear Menu Dialog(3)
			Dialog - Clear Menu Dialog(4)
			Dialog - Clear Menu Dialog(5)
			Dialog - Clear Menu Dialog(6)
			Dialog - Change the title of MenuDialog(1) to Welcome to the Station
			Dialog - Create a dialog button for MenuDialog(1) labelled Tavern
			Set Tavern = (Last created dialog Button)
			Dialog - Create a dialog button for MenuDialog(1) labelled Market
			Set Market = (Last created dialog Button)
			Dialog - Create a dialog button for MenuDialog(1) labelled Forge
			Set Forge = (Last created dialog Button)
			Dialog - Create a dialog button for MenuDialog(1) labelled Tower
			Set Tower = (Last created dialog Button)
			Dialog - Create a dialog button for MenuDialog(1) labelled Exit Station
			Set Exit = (Last created dialog Button)
			Dialog - Show MenuDialog(1) for (Owner of Station_UnitDocked)
		Else - Actions
			Do nothing
	[color=Lime]These following lines are code setup the MenuDialog(4)'s display, since there are many shops like this, and not all items are 

universally available.[/color]
	--------Afterburners-------
	If (All Conditions are True) then do (Then Actions) else do (Else Actions)
		If - Conditions:
			PL_Afterburners[(Player number of (Owner of Station_UnitDocked))] Greater than or equal to 1.00
		Then - Actions:
			Set Station_EquipmentPurchasabilty(1) = Afterburners
			Set Station_Availablity(1) = Afterburner I - 50 isk
			If (All Conditions are True) then do (Then Actions) else do (Else Actions)
				If - Conditions:
					PL_Afterburners[(Player number of (Owner of Station_UnitDocked))] Greater than or equal to 2.00
				Then - Actions:
					Set Station_Availabilty(2) = Afterburner II - 175 isk
					If (All Conditions are True) then do (Then Actions) else do (Else Actions)
						If - Conditions:
							PL_Afterburners[(Player number of (Owner of Station_UnitDocked))] Greater than or equal to 4.00
						Then - Actions:
							Set Station_Availabilty(3) = Afterburner III - 265 isk
						Else - Actions:
							Set Station_Availabilty(3) = Not Available
				Else - Actions:
					Set Station_Availabilty(2) = Not Available
					Set Station_Availabilty(3) = Not Available
			Else - Actions:
				Set Station_EquipmentPurchasabilty(1) = Not Available

Trigger Two: Processing Selection of MenuDialog(1)
Code:
Events:
	Dialog - A dialog button is clicked for MenuDialog(1)
Conditions
Actions:
	[color=Lime]Skipping straight to the concerning code[/color]
	If (All Conditions are True) then do (Then Actions) else do (Else Actions)
		If - Conditions:
			(Clicked dialog button) Equal to Market
		Then - Actions:
			Dialog - Hide MenuDialog(1) for (Owner of Station_UnitDocked)
			Dialog - Clear MenuDialog(1)
			Dialog - Change the title of MenuDialog(2) to Market
			Dialog - Create a dialog button for MenuDialog(2) labelled Equipment
			Set Equipment = (Last created dialog Button)
			Dialog - Create a dialog button for MenuDialog(2) labelled Consumer Goods
			Set ConsumerGoods = (Last created dialog Button)
			Dialog - Show MenuDialog(2) for (Owner of Station_UnitDocked)
		Else - Actions:
				[color=Lime]Other menu items, not concerning my problem (nor have they been written)[/color]

Trigger Three: Processing Selection of MenuDialog(2)
Code:
Events:
	Dialog - A dialog button is clicked for MenuDialog(2)
Conditions
Actions:
	If (All Conditions are True) then do (Then Actions) else do (Else Actions)
		If - Conditions:
			(Clicked dialog button) Equal to Equipment
		Then - Actions:
			Dialog - Hide MenuDialog(2) for (Owner of Station_UnitDocked)
			Dialog - Clear MenuDialog(2)
			Dialog - Change the title of MenuDialog(2) to Equipment
			Dialog - Create a dialog button for MenuDialog(3) labelled Purchase Equipment
			Set PurchaseEquipment = (Last created dialog Button)
			Dialog - Create a dialog button for MenuDialog(3) labelled Sell Equipment
			Set SellEquipment = (Last created dialog Button)
			Dialog - Show MenuDialog(3) for (Owner of Station_UnitDocked)
		Else - Actions:
				[color=Lime]Consumer Goods(Not written)[/color]

Trigger Four: Processing Selection of MenuDialog(3)
Code:
Events:
	Dialog - A dialog button is clicked for MenuDialog(3)
Conditions
Actions:
	If (All Conditions are True) then do (Then Actions) else do (Else Actions)
		If - Conditions:
			(Clicked dialog button) Equal to PurchaseEquipment
		Then - Actions:
			Dialog - Hide MenuDialog(3) for (Owner of Station_UnitDocked)
			Dialog - Clear MenuDialog(3)
			Dialog - Change the title of MenuDialog(4) to Purchasable Equipment
			--------Afterburners--------
			If (All Conditions are True) then do (Then Actions) else do (Else Actions)
				If - Conditions:
					Station_EquipmentPurchaseabilty(1) Equal to Not Available [color=Lime]String Comparsion[/color]
				Then - Actions:
					Dialog - Create a dialog button for MenuDialog(4) labelled Not Available
					Set ReturntoMain = (Last created dialog Button)
				Else - Actions:
					Dialog - Create a dialog button for MenuDialog(4) labelled Afterburners
					Set PurchaseAfterburners = (Last created dialog Button)
		Else - Actions:
				[color=Lime]Sell Equipment(Not written)[/color]

Trigger Five: Processing Selection of MenuDialog(4) This is the trigger that does not appear after a selection is made in Trigger Four
Code:
Events:
	Dialog - A dialog button is clicked for MenuDialog(4)
Conditions:
Actions:
	If (All Conditions are True) then do (Then Actions) else do (Else Actions)
		If - Conditions:
			(Clicked dialog button) Equal to PurchaseAfterburners
		Then - Actions:
			Dialog - Hide MenuDialog(4) for (Owner of Station_UnitDocked)
			Dialog - Clear MenuDialog(4)
			Dialog - Change the title of MenuDialog(5) to Purchasable Afterburners
			Dialog - Create a dialog button for MenuDialog(5) labelled Station_Availabilty(1) [color=Lime]This information is declared in 

Trigger One[/color]
			Set Station_AvailabiltyDialog(1) = (Last created dialog Button)
			Dialog - Create a dialog button for MenuDialog(5) labelled Station_Availabilty(2)
			Set Station_AvailabiltyDialog(2) = (Last created dialog Button)
			Dialog - Create a dialog button for MenuDialog(5) labelled Station_Availabilty(3)
			Set Station_AvailabiltyDialog(3) = (Last created dialog Button)
			Dialog - Show MenuDialog(5) for (Owner of Station_UnitDocked)
		Else - Actions:
				[color=Lime]Other items not concerned(Not written)[/color]

Trigger Six: Processing Selection of MenuDialog(5)
Code:
Events:
	Dialog - A dialog button is clicked for MenuDialog(5)
Conditions:
Actions:
	------Afterburners------
	If (All Conditions are True) then do (Then Actions) else do (Else Actions)
		If - Conditions:
			CurrentIsk[(Player number of (Owner of Station_UnitDocked))] Greater than or equal to 50
			(Clicked dialog button) Equal to Station_AvailabiltyDialog(1)
			INF_AfterburnerSlotFull[(Player number of (Owner of Station_UnitDocked))] = False
		Then - Actions:
			Player - Set (Owner of Station_UnitDocked) Current gold to (CurrentIsk[(Player number of (Owner of Station_UnitDocked))] - 50)
			Set INF_AfterburnersSlotFull[(Player number of (Owner of Station_UnitDocked))] = True
			Dialog - Hide MenuDialog(5) for (Owner of Station_UnitDocked)
			Dialog - Clear MenuDialog(5)
			Unit - Add Afterburner I to Station_UnitDocked
			Dialog - Change the title of MenuDialog(6) to Afterburner Purchased!
			Dialog - Create a dialog button for MenuDialog(6) labelled Return to Main Menu
			Set ReturntoMain = (Last created dialog Button)
			Dialog - Show MenuDialog(6) for (Owner of Station_UnitDocked)
		Else - Actions:
			[color=Lime]Repetition of the above, with different afterburner values[/color]

Ow. My hands hurt. Anyways, those are the triggers. As I stated earlier, the problem occurs with MenuDialog(5) not appearing when selected. Of course, any and all help in my situation is greatly welcomed and appreicated ahead of time.

Thank you.
07-13-2004, 08:13 PM#2
BlueSpine
Any help whatsoever. Ideas, things you don't understand... if someone could tell me I'm pretty...
07-13-2004, 08:25 PM#3
weaaddar
You are asking us to look at 6 very longs triggers that are barely commented and barely implemented and come up with a solution for the bug in a system we and aparently you don't fully understand.
First isolate the problem, if you can add debug messages to see which path the IF statement is going. IF its going the wrong path then you know where your problem is and what to fix. If it goes the right path then maybe its not the if then else, maybe its your var assignment who knows. you just have to try.

Also your triggers are not Advanced dailogs, they are long dialogs triggers I'll give you that though.
07-13-2004, 08:41 PM#4
CynicalYouth
As weaaddar these are some very long triggers, and its hard to debug them just by looking at them. To do it your self, try using the command Game- Display Text to Force to print out the varialbles and put statements inside the ifs to see which way the code is going. If you do this you should be able to figure it out for yourself