TennesseeTuxedo Posted July 16, 2018 Share Posted July 16, 2018 When I'm scripting in Papyrus, some functions don't work and get something like "GetLength is not a function or does not exist" from the compiler. I'm getting this for some not all SKSE and some not all vanilla functions. Ceiling and math functions are the vanilla ones I've discovered don't compile. Other functions work fine, my mod is working using the SKSE GetName() function for example. New to scripts, i'm wondering if I'm missing some basic programming thing, like under some conditions you have to use some kind of "include" statement in your script to include functions from another script. Anyone got some steps to troubleshoot, like what you would check if you hit this issue? Some background:I know about Data>Source>Scripts for the .psc and Data>Scripts for the .pex files (although I'm not clear if psc or pex are used for dependencies by CK at compile time?). I recently moved to MO2 and have CK and SKSE64 setup through that. To edit and compile scripts, I launch CK from MO2, then use the "external editor" options within CK to launch Notepad++ & papyrus plug-in. SKSE is installed as a mod very near the top of the install order. I can verify in CK that I can see all the pex and psc files I think I'm supposed to see. The mod I have been working on works in game (minus the additional features I want to put using these functions that won't work), so the process works. I want to do string manipulation (remove special characters, get string lengths, etc...) so the SKSE functions look very handy. As mentioned some work, but I discovered that the whole SKSE StringUtil set does not work. It's not syntax, I'm testing simple: stringLengthIntVar = GetLength(someStringVar) at this point. All the docs seem to indicate it's a global function, callable by itself (not an object method needing a reference). Same with the vanilla Ceiling function, so why wouldn't a call to that compile? Maybe I'm missing something about using these kind of functions? What's more strange is that I verified from within CK that I can indeed see and open the SKSE StringUtil script from the correct scripts folder, I can see the global GetLength() function declaration in the file, so why can't I call it? That seems to verify the file is in the MO2 virtual file system correctly. Is there something else you need to do to get access to them? Any help appreciated, tearing hair out. Link to comment Share on other sites More sharing options...
Evangela Posted July 16, 2018 Share Posted July 16, 2018 (edited) Are you trying to do this: ceiling(value)floor(value) because it wont compile unless you prefix them with math. Or use import math. I could say more about SKSE but out of fear of being wrong(as I seem to be 95% of time around here), I'll just leave that to someone else. Edited July 16, 2018 by Rasikko Link to comment Share on other sites More sharing options...
Ghaunadaur Posted July 16, 2018 Share Posted July 16, 2018 I don't think it's missing scripts. If some functions (including SKSE) are working, and some are not, you're probably using the wrong syntax. To keep with your example, stringLengthIntVar = GetLength(someStringVar) will not work. The function return an integer value, not a string. Plus, you need to call the StringUtil script before the function. Right syntax would be: int LengthIntVar = StringUtil.GetLength(someStringVar) Link to comment Share on other sites More sharing options...
TennesseeTuxedo Posted July 16, 2018 Author Share Posted July 16, 2018 When I'm scripting in Papyrus, some functions don't work and get something like "GetLength is not a function or does not exist" from the compiler. I'm getting this for some not all SKSE and some not all vanilla functions. Ceiling and math functions are the vanilla ones I've discovered don't compile. Other functions work fine, my mod is working using the SKSE GetName() function for example. New to scripts, i'm wondering if I'm missing some basic programming thing, like under some conditions you have to use some kind of "include" statement in your script to include functions from another script. Anyone got some steps to troubleshoot, like what you would check if you hit this issue? Some background:I know about Data>Source>Scripts for the .psc and Data>Scripts for the .pex files (although I'm not clear if psc or pex are used for dependencies by CK at compile time?). I recently moved to MO2 and have CK and SKSE64 setup through that. To edit and compile scripts, I launch CK from MO2, then use the "external editor" options within CK to launch Notepad++ & papyrus plug-in. SKSE is installed as a mod very near the top of the install order. I can verify in CK that I can see all the pex and psc files I think I'm supposed to see. The mod I have been working on works in game (minus the additional features I want to put using these functions that won't work), so the process works. I want to do string manipulation (remove special characters, get string lengths, etc...) so the SKSE functions look very handy. As mentioned some work, but I discovered that the whole SKSE StringUtil set does not work. It's not syntax, I'm testing simple: stringLengthIntVar = GetLength(someStringVar) at this point. All the docs seem to indicate it's a global function, callable by itself (not an object method needing a reference). Same with the vanilla Ceiling function, so why wouldn't a call to that compile? Maybe I'm missing something about using these kind of functions? What's more strange is that I verified from within CK that I can indeed see and open the SKSE StringUtil script from the correct scripts folder, I can see the global GetLength() function declaration in the file, so why can't I call it? That seems to verify the file is in the MO2 virtual file system correctly. Is there something else you need to do to get access to them? Any help appreciated, tearing hair out. That was it! They have to be prefixed with the library/script object name. A lot of docs don't show this but I discovered looking through the code samples, which I should have checked for first. Thanks for the replies! Link to comment Share on other sites More sharing options...
Recommended Posts