prideslayer Posted May 24, 2014 Posted May 24, 2014 Before I start fiddling with this, because my brain isn't so good with this kind of thinking, if I have an event where a player normally has a token with a "removeme" at the end just so I can process that script when it's called, instead I could just do "call ScriptNameHere" and process the script without adding a token? If you're just giving them the token in order to have the script run then yes. You put the code in your UDF script instead, and call it instead of giving them the token. It will run right then.
Loogie Posted May 25, 2014 Posted May 25, 2014 Hot. Since I have to rebuild Vault 19 again anyway, this information is golden.
prideslayer Posted May 25, 2014 Posted May 25, 2014 What's with all this 'Hot'? You channeling paris hilton?
Loogie Posted May 25, 2014 Posted May 25, 2014 Some dude I knew in high school introduced it to us as slang like five years before it came out of Paris Hilton's fat salty mouth. Slips out as a confirmation of positive information sometimes.
prideslayer Posted May 31, 2014 Posted May 31, 2014 Is there a trick to calling a UDF from the console, or is it just mission unpossible right now?
DoctaSax Posted June 7, 2014 Author Posted June 7, 2014 Slightly adjusted to state that you can have up to 10 params to a UDF - I wrongly assumed there was no limit. Jaam's extended it to 15 with NVSE 4.5 beta 1.
Halstrom Posted July 4, 2014 Posted July 4, 2014 Anyone know how this handles things if more than one script calls it at once? Â Say I have 2 Pregnant nPC's actors running their TokenPregnantActor scripts and I outsource calculating Bellysize or something to a Function and 2 actors call the function on the same frame?
DoctaSax Posted July 4, 2014 Author Posted July 4, 2014 Not sure, Hal. I'm gonna go out on a limb and say it'd work in the way that spell scripts or object scripts on different refs work in a single frame, ie different instances happening on the different refs (if that's what happens, who knows these things...)
Guest tomm434 Posted July 4, 2014 Posted July 4, 2014 Anyone know how this handles things if more than one script calls it at once? Â Say I have 2 Pregnant nPC's actors running their TokenPregnantActor scripts and I outsource calculating Bellysize or something to a Function and 2 actors call the function on the same frame? Â My game crashed when I was CIOSing 3 SexoutNGFinish spells at the same time (3 lines in a row). So I used simple While iCount2 <6 let iCount2 +=1 loop
nyaalich Posted July 4, 2014 Posted July 4, 2014 Not well versed, but it seems like calling a spell in three different lines shouldn't make things explode.
Guest tomm434 Posted July 4, 2014 Posted July 4, 2014 I was doing it on different actors (have 3 animations going at the same time - needed to make sure that they stop before player leaves the cell).
Halstrom Posted July 4, 2014 Posted July 4, 2014  Anyone know how this handles things if more than one script calls it at once?  Say I have 2 Pregnant nPC's actors running their TokenPregnantActor scripts and I outsource calculating Bellysize or something to a Function and 2 actors call the function on the same frame?  My game crashed when I was CIOSing 3 SexoutNGFinish spells at the same time (3 lines in a row). So I used simple While iCount2 <6 let iCount2 +=1 loop  Hmm I think if I had no choice I'd rather set a global Boolean bUDFBusy, just before calling it and a check that as a condition before calling it and have the UDF reset it at the end of it's script. But that still may not work if they were called at exactly the same frame dependant on whether the global registers as 1 in time as I'm thinking even if they run the same frame one will still run before the other, but if it's like PLC's then the global could still read 0 to the next frame. And seeing this is a Fallout specific Tutorial I'm thinking it should be in a Fallout section as I keep forgetting there's stuff here in the main Tutorials, which I expect more for Non-Game specific stuff like Blender etc.
Halstrom Posted July 18, 2014 Posted July 18, 2014 I just worked out if you want to cause a CTD, just try have the UDF remove a token containing the script calling the UDF
Guest tomm434 Posted July 27, 2014 Posted July 27, 2014 I'm trying to create a universal function which will reset quest+ particular variable from different quest and function doesn't work! Scriptname MyFunction int Variable int LocalVariable begin Function {LocalVariable} let Variable :=LocalVariable let Variable := 2 {other code} end (I also tried removing "Variable" and modifying "LocalVariable" directly) Â The call from dialogue looks like this call MyFunction Quest.MyVariable Please tell me what's wrong with this. {or should I do trick with "Let MyQuest.MyVariable := call MyFunction"} ? Â
DoctaSax Posted July 27, 2014 Author Posted July 27, 2014 Explain a bit what you're trying to do, tomm. I'd avoid calling a parameter variable a local variable - that's just confusing
Guest tomm434 Posted July 27, 2014 Posted July 27, 2014 I have many repeatable dialogue and each of them require resetting the quest. The only difference is that there is unique variable for each topic. That's why I decided to make function which will reset quest + set variable I want to a certain value (2). So I call "call MyFunction Myquest2.Myvariable" - quest1 is reset + Myquest2.MyVariable is set to 2.
DoctaSax Posted July 27, 2014 Author Posted July 27, 2014 Hm, yeah, that's not gonna work.  When you call somefunction quest.somevar you're really passing along the value of that var to the udf, not the actual var   you could use let quest.somevariable := call somefunction  or  call somefunction questref "variablename" somevalue and then use GetVariable/SetVariable etc
Guest tomm434 Posted July 27, 2014 Posted July 27, 2014 So I'm just passing it. Good to know. Thanks again!
Guest Posted July 27, 2014 Posted July 27, 2014 I just wanted to point out a thing that I found on UDFs. I have this: ESM -> contains UDFs ESP -> calls UDFs from the ESM I changed one of the UDFs in the ESM, adding a boolean parameter, but just for curiosity I didn't change the ESP (so it was calling the UDF but still missing a parameter, that usually doesn't compile if you open the script). If the boolean parameter was true, the UDF had to do new functions. In game everything worked fine, my guess is it automatically interpreted the boolean as false. I'm pretty sure it didn't skip pieces of script because it was a complicated UDF. Anyway it didn't crash, that's quite relieving.
prideslayer Posted March 29, 2015 Posted March 29, 2015 Having the weirdest issue right now changing the interface to a UDF, NVSE 4.5.7.  A UDF defined like this: scn fnSexoutArCompare ; Compares two arrays to see if they are equal. ; args array_var arLHS array_var arRHS string_var stWild ; ... Begin Function{arLHS arRHS} ... End And called like this: if eval(0 == (call fnSexoutArCompare inActFilt, arResult[item["value"]]["actors"])) ; ... Works fine. Changing the definition to this: Begin Function{arLHS arRHS stWild} And the call to this: if eval(0 == (call fnSexoutArCompare inActFilt, arResult[item["value"]]["actors"], "both")) Results in NVSE reporting an error in the calling script. Operator := failed to evaluate to a valid result No other changes made at all, the UDF isn't using the 3rd param yet. I tried commenting out the call to the UDF so that no scripts were using it, saving, quitting, restarting geck, and then changing the UDF definition and adding the call back in. No help. Going to try a newer NVSE now but if anyone has seen this before, I'd like to know.
prideslayer Posted March 29, 2015 Posted March 29, 2015 Same behavior with NVSE 4.6.2. Removing the "sv_destruct stWild" at the end of the UDF had no effect either. That's the only place it's referenced in the UDF at present. Dafuck is goin' on.
prideslayer Posted March 29, 2015 Posted March 29, 2015 Ok, so this doesn't work: if eval(0 == (call fnSexoutArCompare inActFilt, arResult[item["value"]]["actors"], "both")) But this does: let stTmp := "both" if eval(0 == (call fnSexoutArCompare inActFilt, arResult[item["value"]]["actors"], stTmp)) *facepalm*
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now