gwave Posted July 5, 2014 Posted July 5, 2014 Hello, First of all, I don't know much about scripting. So there might be an error so obvious that nobody ever had the same problem as me. Recently I wanted to get into Skyrim Scripting, but my success so far is very limited. I'm using this http://www.cipscis.com/skyrim/tutorials/beginners.aspx#Functions tutorial and I'm working with Notepad++. Now I can define functions without problems. Such as the example in the tutorial: int Function Max(int a, int global {Returns the largest value out of two integers} if (a > Return a else Return b endif EndFunction But when I want to call that function with int c = Max(3, 6) I get and error when compiling: "no viable alternative at "Max". Or when I just call the functions without assigning a new variable: Max(3, 6) I get an similar error. "no viable alternative at "(".
Fotogen Posted July 5, 2014 Posted July 5, 2014 I tried your sample. It compiled fine. My guess is, that its not the problem with the line where you called function Max, but with code that is "before" that line. Dunno, something like "If" that doesn't have "EndIf" or something like that.
Guest airdance Posted July 5, 2014 Posted July 5, 2014 Look for a typo in the lines just previous to this inline function.
gwave Posted July 5, 2014 Author Posted July 5, 2014 In the line before is nothing. You can see it in this picture. I already tried to compile scripts from other mods that should run fine. And evertime I get this error when they call a function. Must be some errror with the compiler. I'm thinking about reinstalling Skyrim and all updates, but my Internet is terribly slow and that would take several days.
CGi Posted July 5, 2014 Posted July 5, 2014 Are you using MO?if yes: edit StartCompile.BAT and add the paths to the source scripts you use to the -i parameter.
Heromaster Posted July 5, 2014 Posted July 5, 2014 You need to bind your script to an object first. Create a quest and add your script in the Script Tab. The first line has then to be rewritten to ScriptName test Extends Quest Then it should work.
gwave Posted July 5, 2014 Author Posted July 5, 2014 Are you using MO? if yes: edit StartCompile.BAT and add the paths to the source scripts you use to the -i parameter. No, I'm using Notepad++. I set everything up so I can compile the file with Strg+F5. Compiling works fine as long as I don't call a function. @Heromaster You (or I can't) bind an uncompiled script to any object. It needs to be compiled from .psc do .pex first.
Heromaster Posted July 5, 2014 Posted July 5, 2014 And why don't you compile it first and then bind it? Or even better add a new script, which does both steps?
gwave Posted July 5, 2014 Author Posted July 5, 2014 Just did what you said and it doesn't work either. I think I'm going to reinstall Skyrim and try it on a clean game. Will inform you in a few days if I have success.
h38fh2mf Posted July 5, 2014 Posted July 5, 2014 Maybe you can't use functions outside of other functions or events. This line: int c = Max(3, 6) just outside of everything else looks wrong.
gwave Posted July 6, 2014 Author Posted July 6, 2014 Thanks h38fh2mf! I knew it was some stupid mistake on my part.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.