Papyrus Compiling Error

Post » Sun Jun 17, 2012 4:03 pm

Anyone know what the error "missing EOF at 'if'" means?

Scriptname AmuletLocator2 extends ObjectReference  Quest Property NewProperty1  Auto  if (NewProperty1.GetStage() == 40)    Event OnContainerChanged (ObjectReference newContainer, ObjectReference oldContainer)        if (newContainer != Game.GetPlayer())            NewProperty1.SetStage(20)        endifelseendifEndEvent
User avatar
Marlo Stanfield
 
Posts: 3432
Joined: Wed May 16, 2007 11:00 pm

Post » Sun Jun 17, 2012 11:12 pm

EOF stands for End Of File. It will give that error when your script isn't structured properly. Here's the structure in your script:
  • if
    • event
      • if
      • endif
    • else
    • endif
  • endevent
The bold if, else, endif should line up and the underlined event and endevent should line up as well. Restructure your script with the event first and then the if.

You can also remove the else-statement, since you don't have anything between the else and the endif.
User avatar
RObert loVes MOmmy
 
Posts: 3432
Joined: Fri Dec 08, 2006 10:12 am

Post » Sun Jun 17, 2012 10:46 pm

Well, I straightened that out, but for some reason my code doesn't seem to work.

Event OnContainerChanged (ObjectReference newContainer, ObjectReference oldContainer)		if (newContainer != Game.GetPlayer() && NewProperty1.GetStage() == 30)			NewProperty1.SetStage(20)		endifEndEvent

NewProperty1 = GSQ01 *Quest Identifier.

This is based of of the CK wiki Tutorial, I'm trying to make the quest stage reset to 20 when the amulet is not in the player's inventory, and has been previously been removed from the theif.

Anyone know the problem?
User avatar
Samantha hulme
 
Posts: 3373
Joined: Wed Jun 21, 2006 4:22 pm

Post » Mon Jun 18, 2012 4:01 am

Always link to the exact tutorial you're currently following.

This code doesn't run when the object has changed containers before stage 30 was reached. It only runs when the object changes containers. Could that be the problem?
User avatar
Alina loves Alexandra
 
Posts: 3456
Joined: Mon Jan 01, 2007 7:55 pm

Post » Sun Jun 17, 2012 5:15 pm

Always link to the exact tutorial you're currently following.

This code doesn't run when the object has changed containers before stage 30 was reached. It only runs when the object changes containers. Could that be the problem?

Well yes and no. I had it working... however:

When i started my game it automatically sent me to Stage 20 of the quest because I didn't have the Stage Condition included in the code, therfore whenever the amulet was placed into the game world, the code executed. I'm trying to make the stage set to 20 only when the amulet is removed from inventory, and only after recieving the amulet for the first time (Stage 30). Don't understand what is wrong with my logic. Script compiles alright, but doesn't work as intended. Dropping the amulet (or placing it in a different container) does not change the quest stage.
User avatar
sam
 
Posts: 3386
Joined: Sat Jan 27, 2007 2:44 pm

Post » Sun Jun 17, 2012 6:47 pm

I'd make a separate state for the situation that the player had the amulet but dropped it again. That should make your logic a bit easier:
  • It will exit stage 20 and enter 30 as soon as the amulet is added to the player.
  • If the amulet is changed inventories to a non-player container when above stage 20, then it moves to stage 40.
  • It moves back to stage 30 when the player picks up the amulet again.
User avatar
Chica Cheve
 
Posts: 3411
Joined: Sun Aug 27, 2006 10:42 pm


Return to V - Skyrim