drmmrdude22 Posted October 11, 2012 Share Posted October 11, 2012 Hi everyone! I was hoping someone out there may be kind enough to give me a pointer on why Papyrus HATES what I'm trying to do. Now, I'm relatively new to programming, but if you talk slow I'm pretty sure I can keep up. What I'm attempting to start off doing is simply create a function that adds 2 integers (floats, eventually), and return that value. Then, I want to take the return of that value, and assign it to another value. Scriptname Trials extends ObjectReference int Function AddTwo(int a, int b) global return a + bendFunction int x = AddTwo(2,2) Bonus points if you can help me figure out how to do this with using the RandomFloat() function. I truly appreciate it guys! Happy Modding! Link to comment Share on other sites More sharing options...
drmmrdude22 Posted October 11, 2012 Author Share Posted October 11, 2012 Just kidding guys, I figured it out. Honestly though, someone (probably will be me eventually) needs to go and fix half the articles on the wiki, they are straight wrong and completely misreading. Link to comment Share on other sites More sharing options...
ciakko Posted October 12, 2012 Share Posted October 12, 2012 Hi,From what I see this function makes the sum of the values of a + b and names it "AddTwo".So everytime you want the sum of a+b you ave only to use the function AddTwo.int Function AddTwo(int a, int b) global return a + b endFunction Is the same as in C++ I'm relative new to Papyrus me too but this string seems wrong.int x = AddTwo(2,2) I would have previously define the Integer:Int a = 2Int b = 2 int Function AddTwo(int a, int b) global return a + b endFunction Int x = AddTwo I hope to have help you Link to comment Share on other sites More sharing options...
steve40 Posted October 17, 2012 Share Posted October 17, 2012 I'm relative new to Papyrus me too but this string seems wrong.int x = AddTwo(2,2) Nope, it's perfectly correct. What is wrong is that this statement cannot be called outside of an event block or function :tongue: . Scriptname Trials extends ObjectReference int Function AddTwo(int a, int b) global return a + b endFunction Event OnInit() int x = AddTwo(2,2) debug.trace("The answer is " + x) EndEvent Link to comment Share on other sites More sharing options...
Recommended Posts