Zylice Posted May 4, 2015 Share Posted May 4, 2015 I have tried retyping this script and this error just keeps coming up whenever I try to compile: "mismatched input '<EOF>' expecting ENDIF" What am I doing wrong? Here's the script: ;=========================;PROPERTIES;========================= Message Property ZyMenu Auto Armor Property ArmorIronCuirass Auto Armor Property ArmorSteelCuirass Auto MiscObject Property Gold001 Auto ;=========================;EVENT ;========================= Event OnActivate (ObjectReference akActionRef)Menu()EndEvent Function Menu (int aiButton = 0)aiButton = ZyMenu.show()If aiButton == 0 ElseIf aiButton == 1If (Game.GetPlayer().GetItemCount(Gold001) >=100) Game.GetPlayer().RemoveItem(Gold001, 100) debug.messagebox("You have purchased Iron Armor")Game.GetPlayer().AddItem(ArmorIronCuirass) ElseIf aiButton == 2If (Game.GetPlayer().GetItemCount(Gold001) >=150)Game.GetPlayer().RemoveItem(Gold001, 150)debug.messagebox("You have purchased Steel Armor")Game.GetPlayer().AddItem(ArmorSteelCuirass) EndIf Thanks for any help! :) Link to comment Share on other sites More sharing options...
acidzebra Posted May 4, 2015 Share Posted May 4, 2015 You've got nested if statements but not a matching number of endif statements. All if statements should be closed out with endif statements, even if you use elseif statements in between. If aiButton == 0 ElseIf aiButton == 1 If (Game.GetPlayer().GetItemCount(Gold001) >=100) Game.GetPlayer().RemoveItem(Gold001, 100) debug.messagebox("You have purchased Iron Armor") Game.GetPlayer().AddItem(ArmorIronCuirass) EndIf ElseIf aiButton == 2 If (Game.GetPlayer().GetItemCount(Gold001) >=150) Game.GetPlayer().RemoveItem(Gold001, 150) debug.messagebox("You have purchased Steel Armor") Game.GetPlayer().AddItem(ArmorSteelCuirass) EndIf EndIf Link to comment Share on other sites More sharing options...
Zylice Posted May 4, 2015 Author Share Posted May 4, 2015 You've got nested if statements but not a matching number of endif statements. All if statements should be closed out with endif statements, even if you use elseif statements in between. If aiButton == 0 ElseIf aiButton == 1 If (Game.GetPlayer().GetItemCount(Gold001) >=100) Game.GetPlayer().RemoveItem(Gold001, 100) debug.messagebox("You have purchased Iron Armor") Game.GetPlayer().AddItem(ArmorIronCuirass) EndIf ElseIf aiButton == 2 If (Game.GetPlayer().GetItemCount(Gold001) >=150) Game.GetPlayer().RemoveItem(Gold001, 150) debug.messagebox("You have purchased Steel Armor") Game.GetPlayer().AddItem(ArmorSteelCuirass) EndIf EndIf It still shows the same error message. Link to comment Share on other sites More sharing options...
mrpwn Posted May 8, 2015 Share Posted May 8, 2015 (edited) This should work. ;========================= ;PROPERTIES ;========================= Message Property ZyMenu Auto Armor Property ArmorIronCuirass Auto Armor Property ArmorSteelCuirass Auto MiscObject Property Gold001 Auto Actor Property PlayerRef Auto ;========================= ;EVENT ;========================= Event OnActivate (ObjectReference akActionRef) Menu() EndEvent Function Menu(int aiButton = 0) aiButton = ZyMenu.show() If aiButton == 0 ;Do nothing ElseIf aiButton == 1 If (PlayerRef.GetItemCount(Gold001) >=100) PlayerRef.RemoveItem(Gold001, 100) debug.messagebox("You have purchased Iron Armor") PlayerRef.AddItem(ArmorIronCuirass) EndIf ElseIf aiButton == 2 If (PlayerRef.GetItemCount(Gold001) >=150) PlayerRef.RemoveItem(Gold001, 150) debug.messagebox("You have purchased Steel Armor") PlayerRef.AddItem(ArmorSteelCuirass) EndIf EndIf EndFunction The problem was, as acidzebra stated, a lack of EndIf keywords to end the If-ElseIf-EndIf-blocks. I also replaced the repeated Game.GetPlayer() calls with an Actor property, which you'll need to fill (you can just use the auto-fill button since the name of the property is the same as an existing reference). Edited May 8, 2015 by mrpwn Link to comment Share on other sites More sharing options...
Zylice Posted May 8, 2015 Author Share Posted May 8, 2015 This should work. ;========================= ;PROPERTIES ;========================= Message Property ZyMenu Auto Armor Property ArmorIronCuirass Auto Armor Property ArmorSteelCuirass Auto MiscObject Property Gold001 Auto Actor Property PlayerRef Auto ;========================= ;EVENT ;========================= Event OnActivate (ObjectReference akActionRef) Menu() EndEvent Function Menu(int aiButton = 0) aiButton = ZyMenu.show() If aiButton == 0 ;Do nothing ElseIf aiButton == 1 If (PlayerRef.GetItemCount(Gold001) >=100) PlayerRef.RemoveItem(Gold001, 100) debug.messagebox("You have purchased Iron Armor") PlayerRef.AddItem(ArmorIronCuirass) EndIf ElseIf aiButton == 2 If (PlayerRef.GetItemCount(Gold001) >=150) PlayerRef.RemoveItem(Gold001, 150) debug.messagebox("You have purchased Steel Armor") PlayerRef.AddItem(ArmorSteelCuirass) EndIf EndIf EndFunction The problem was, as acidzebra stated, a lack of EndIf keywords to end the If-ElseIf-EndIf-blocks. I also replaced the repeated Game.GetPlayer() calls with an Actor property, which you'll need to fill (you can just use the auto-fill button since the name of the property is the same as an existing reference).It worked. Thankyou. :) Link to comment Share on other sites More sharing options...
Recommended Posts