Halstrom Posted August 14, 2018 Posted August 14, 2018 I suck at arrays. I've checked the array is this: [0, [[Actor < (00000014)>], [RentRoomScript < (00002EFF)>]], "Staged LeitoStanding Doggy 2", ["Held1", "Sub1", "PencilToEither"]] But this script keeps returning my "EmptyArray" Message, Actors and Position are reading fine so I'm screwing up the reading process using String[] in someway? ; *** Unpack the rActors which are in akArgs[1] and populate the new array "rActors" with them Actor[] rActors = Utility.VarToVarArray(akArgs[1]) as Actor[] Actor rActor0 = rActors[0] Actor rActor1 = rActors[1] Actor rActor2 = rActors[2] Actor rActor3 = rActors[3] Actor rActor4 = rActors[4] ; *** The Position playing: String sPosition = akArgs[2] as String ; *** Unpack the tags which are in akArgs[3] and populate the new array "sTags" with them String[] sTags = Utility.VarToVarArray(akArgs[3]) as String[] If (sTags) Int iArrayLength = sTags.Length Int j While (j < iArrayLength) String sTag = sTags[j] fnCheckAnimationTag(sTag) j += 1 EndWhile fSexHappening = 1 Float fSexPenetrationPerc = (fPenOral + fPenVaginal + fPenAnal) / 100 * fPenSize gSexPenetrationPerc.SetValue(fSexPenetrationPerc) StartTimer(fFrequencyTimer, iTimerID) Else fnDebug("Start:EmptyTagArray: " + sPosition + "/" + sTags) EndIf
Carreau Posted August 14, 2018 Posted August 14, 2018 EDIT: I'm a dork. Try using VarArrayToVar instead. Then you can cast it as String sTags = Utility.VarArrayToVar(akArgs[3]) as string
Halstrom Posted August 14, 2018 Author Posted August 14, 2018 8 minutes ago, Carreau said: EDIT: I'm a dork. Try using VarArrayToVar instead. Then you can cast it as String sTags = Utility.VarArrayToVar(akArgs[3]) as string Hmm so do this: String[] ssTags = Utility.VarArrayToVar (akArgs[3]) as String[] String sTags = Utility.VarArrayToVar(ssTags[3]) as String
Carreau Posted August 14, 2018 Posted August 14, 2018 I'm not at all familiar with these functions, but looking at what the F4SE dev had to say on Reddit: It looks like the functions were included to translate from Var[ ] as Var and Var as Var[ ]. In his example call, he doesn't use the functions to strip from the Var array and cast. He just directly casts. So, in your code, you should be using: String sTag = akArg[3] as String That should be sufficient. I know in my vore scripting, I've done similar to pass actors, ints, etc. CKWiki seems to support that you can cast into string as well. https://www.creationkit.com/fallout4/index.php?title=Cast_Reference Quote Cast to String Compiler auto-cast from: Anything Anything can be cast to strings. The result that you get depends on the type of object that you are casting from, according to the following table: Expression type Resulting string Bool "True" or "False" depending on the value Int The string version of the integer Float The string version of the float Objects A string representing the object in the format: "[ScriptName <EditorID (FormID)>]" Arrays A list of elements in the array separated by commas, formatted as above, and possibly truncated with a "..." if too long for the internal string buffer. Structs A list of the values in the struct separated by commas, and possibly truncated with a "..." if too long for the internal string buffer. Var Whatever the contents of the var would cast to I bolded the Var as string line.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.