Snowraptor Posted February 14, 2012 Posted February 14, 2012 (edited) I'm trying to create what should be a simple script to check if someone has a spell and if they do not then add it. Instead I get this error when I compile, (5,0): missing EOF at 'if' Scriptname InsertSpellName extends ObjectReference {The} Spell Property InsertSpellName Auto if (Game.GetPlayer.HasSpell(InsertSpellName) == 0) Game.AddSpell(InsertSpellName) endIf Not sure how I'm getting an end of file error on "if". I know there's more errors to this than just that, but no matter what is put after the property declaration I get the same EOF error. Edited February 14, 2012 by Snowraptor
Cipscis Posted February 14, 2012 Posted February 14, 2012 You're missing parentheses after Game.GetPlayer:Scriptname InsertSpellName extends ObjectReference {The} Spell Property InsertSpellName Auto if (Game.GetPlayer().HasSpell(InsertSpellName) == false) Game.AddSpell(InsertSpellName) endIfAlso, note that I've changed "== 0" to "== false". We have proper "bool" types now, so even though yours would work due to automatic casting, using "false" is more semantically correct. Cipscis
Snowraptor Posted February 14, 2012 Author Posted February 14, 2012 (edited) I still get the EOF error. I tried removing the if/else to see if it would work without them (I realize I need it to perform the check) and got this error instead; (5,4): no viable alternative at input '.' Scriptname InsertSpellName extends ObjectReference {The} Spell Property InsertSpellName Auto Game.GetPlayer().HasSpell(InsertSpellName) == false Game.AddSpell(InsertSpellName) Is there some other property I need to set up that I'm missing? Removing Game.GetPlayer().HasSpell(Fireball) == false will give me the same error but with Game.AddSpell instead. Edited February 14, 2012 by Snowraptor
Cipscis Posted February 14, 2012 Posted February 14, 2012 I still think it's really strange that you get an EOF error at all... Maybe there's some funny extra character in there that's not being displayed by your text editor? If you write it out again from scratch, does the same thing happen? Cipscis
Snowraptor Posted February 14, 2012 Author Posted February 14, 2012 I had the same thought and I have three different scripts made each with the same error. I've just been using the default editor because this is 6 lines and I haven't set up Notepad++ with the papyrus compiler. Only experience I have with EOF (assuming that represents end of file) is when dealing with text documents so it is completely baffling how the compiler finds an EOF error at "if". I'll set up Notepad++ tomorrow, maybe the default editor just doesn't like me.
dread420 Posted February 18, 2012 Posted February 18, 2012 I'm Having the exact same issue. missing EOF at 'if' and removing if/endif gets me no viable alternative at input '.'
darkylord Posted February 18, 2012 Posted February 18, 2012 I'm not sure if that has something to do with the problem but you miss the .GetPlayer () when you give him the spell, which should be : Game.GetPlayer().AddSpell(InsertSpellName)
tunaisafish Posted February 18, 2012 Posted February 18, 2012 In this case, does EOF stand for missing Event Or Function? Once you fix what darkylord pointed out, that's valid code for the body of an EOF :)
douchebagssuck Posted November 2, 2013 Posted November 2, 2013 Rename your script. For me on this same error the engine didn't like my script name. Sometimes when pasting out of notepad it may add an ; or there is a ; missing... that happened once or twice too, but different error.
Terra Nova Posted November 2, 2013 Posted November 2, 2013 Old thread man, but the problem with this script is obvious. You can't run statements outside of an event or function. Compiler was expecting and Event or Function. That's not to say this is was "EOF" means, because I don't know, but looking at the script the OP posted, this is the case. Though, the OP could be hiding the rest of the code, I guess. Doesn't matter.
Recommended Posts