WraithSlayer Posted January 18, 2015 Posted January 18, 2015 Is there something wrong with the following code? sslBaseAnimation[] anims anims = SexLab.GetAnimationsByTags(2, "Lesbian") I get a Papyrus error at the second line, namely: [01/18/2015 - 10:41:05AM] SexLab: Making thread[0] [sslThreadController <alias ThreadView014 on quest SexLabQuestThreadSlots (1003CE6E)>] [01/18/2015 - 10:41:05AM] SexLab Thread[0] ModEvent: ThreadOpened [01/18/2015 - 10:41:05AM] -- SexLab ActorAlias -- Thread[0] Slotted 'Prisoner' into alias -- [sslactoralias <alias ActorSlot074 on quest SexLabQuestActorSlots (1003CE6B)>] [01/18/2015 - 10:41:05AM] SexLab Thread[0] ModEvent: PlayerAdded [01/18/2015 - 10:41:05AM] -- SexLab ActorAlias -- Thread[0] Slotted 'Carlotta Valentia' into alias -- [sslactoralias <alias ActorSlot073 on quest SexLabQuestActorSlots (1003CE6B)>] [01/18/2015 - 10:41:05AM] --- SexLab Animation Search ------------------------------ [01/18/2015 - 10:41:05AM] GetByTags(2, ["Lesbian"], [], TRUE) [01/18/2015 - 10:41:05AM] Found [4] Animations: Tribadism, Arrok Lesbian, Zyn Lesbian, Zyn Licking, [01/18/2015 - 10:41:05AM] ---------------------------------------------------------- [01/18/2015 - 10:41:05AM] Error: Cannot cast from None to sslbaseanimation[] stack: [SSv2System (83002386)].SSv3Handler.SexForTwo() - "SSv3Handler.psc" Line 143 [topic info 8301B529 on quest SSv2System (83002386)].SSv2_TIF__0301B529.Fragment_1() - "SSv2_TIF__0301B529.psc" Line 18 [01/18/2015 - 10:41:06AM] SexLab Thread[0] ModEvent: AnimationStart // PlayerAnimationStart However, despite the error, the SexLab animation still starts as expected, with the correct animation restrictions. Can I just ignore this error, or am I doing something wrong with the anims array?
Ashal Posted January 18, 2015 Posted January 18, 2015 Is there something wrong with the following code? sslBaseAnimation[] anims anims = SexLab.GetAnimationsByTags(2, "Lesbian") I get a Papyrus error at the second line, namely: [01/18/2015 - 10:41:05AM] Error: Cannot cast from None to sslbaseanimation[] stack: [SSv2System (83002386)].SSv3Handler.SexForTwo() - "SSv3Handler.psc" Line 143 [topic info 8301B529 on quest SSv2System (83002386)].SSv2_TIF__0301B529.Fragment_1() - "SSv2_TIF__0301B529.psc" Line 18 However, despite the error, the SexLab animation still starts as expected, with the correct animation restrictions. Can I just ignore this error, or am I doing something wrong with the anims array? Is the source of the error, SSv3Handler.psc your script creating the 4 animation? If yes, show me the contents of that script, and possibly the contents of the fragment calling the script as well. If it works as expected despite the error, I'd suspect you're either handling the function's result wrong, or attempting to error check in an an incorrect way.
WraithSlayer Posted January 18, 2015 Author Posted January 18, 2015 Is the source of the error, SSv3Handler.psc your script creating the 4 animation? If yes, show me the contents of that script, and possibly the contents of the fragment calling the script as well. If it works as expected despite the error, I'd suspect you're either handling the function's result wrong, or attempting to error check in an an incorrect way. SSv3Handler: Scriptname SSv3Handler extends Quest SexLabFramework Property SexLab Auto SSv3Config Property SSv3MCM Auto Actor Property PlayerRef Auto Function SexForTwo(Actor partner, String context = "mutual", String type = "Any", int victim = -1, bool aggressive = false, bool allowLeadIn = true) ;context can be "mutual", "pleasuring", or "pleasured" (rape scenarios don't use this parameter, so no need to pass it in the function call) ;type can be "Any", "Aggressive" or a SexLab animation tag, like "Vaginal", "Anal", "Oral" (if new tags are used, Stage 4 will automatically attempt to use the tag for anim-search) int playerGender = PlayerRef.GetLeveledActorBase().GetSex() int partnerGender = partner.GetLeveledActorBase().GetSex() Bool playerVictim = false Bool partnerVictim = false sslThreadModel Model = SexLab.NewThread() ;STAGE 1 - Mark actors as victims if applicable ;victim Function parameter: -1=consensual | 0=playerVictim | 1=partnerVictim if victim == 0 playerVictim = true ElseIf victim == 1 partnerVictim = true EndIf ;STAGE 2 - Arrange animation positions depending on genders and context ;2.1 Rape If playerVictim Model.AddActor(PlayerRef, playerVictim) Model.AddActor(partner, partnerVictim) ElseIf partnerVictim Model.AddActor(partner, partnerVictim) Model.AddActor(PlayerRef, playerVictim) ;2.2 Consensual ElseIf context == "pleasuring" If partnerGender == 0 Model.AddActor(PlayerRef, playerVictim) Model.AddActor(partner, partnerVictim) Else Model.AddActor(partner, partnerVictim) Model.AddActor(PlayerRef, playerVictim) EndIf ElseIf context == "pleasured" If playerGender == 0 Model.AddActor(partner, partnerVictim) Model.AddActor(PlayerRef, playerVictim) Else Model.AddActor(PlayerRef, playerVictim) Model.AddActor(partner, partnerVictim) EndIf Else ;context = "mutual" If playerGender != partnerGender ;straight sex If (playerGender == 0 && SSv3MCM.op_StraightPositioning == true) || (playerGender == 1 && SSv3MCM.op_StraightPositioning == false) ;player is male vanilla or female pegging Model.AddActor(partner, partnerVictim) Model.AddActor(PlayerRef, playerVictim) Else ;player is female vanilla or male pegged Model.AddActor(PlayerRef, playerVictim) Model.AddActor(partner, partnerVictim) EndIf ElseIf (playerGender == 1 && partnerGender == 1) ;lesbian sex If SSv3MCM.op_LesbianPositioning == true ;player receiver Model.AddActor(PlayerRef, playerVictim) Model.AddActor(partner, partnerVictim) Else ;player giver Model.AddActor(partner, partnerVictim) Model.AddActor(PlayerRef, playerVictim) EndIf ElseIf (playerGender == 0 && partnerGender == 0) ;gay sex If SSv3MCM.op_GayPositioning == true ;player top Model.AddActor(partner, partnerVictim) Model.AddActor(PlayerRef, playerVictim) Else ;player bottom Model.AddActor(PlayerRef, playerVictim) Model.AddActor(partner, partnerVictim) EndIf EndIf EndIf ;STAGE 3 - Set leadIn animation rules if allowLeadIn == false || playerVictim == true || partnerVictim == true ;explicitly disable leadIn Model.DisableLeadIn() Else ;use contextual & MCM rules If type == "Oral" ;disable for Oral anims, since LeadIn is usually redundant or deviates from intended animation (also causes issues like: female player + male beggar, starting with blowjob and finish in licking) Model.DisableLeadIn() ElseIf (playerGender != partnerGender) && (SSv3MCM.op_StraightForeplay == false) Model.DisableLeadIn() ElseIf (playerGender == 1 && partnerGender == 1) && (SSv3MCM.op_LesbianForeplay == false) Model.DisableLeadIn() ElseIf (playerGender == 0 && partnerGender == 0) && (SSv3MCM.op_GayForeplay == false) Model.DisableLeadIn() EndIf EndIf ;STAGE 4 - Prepare animations list sslBaseAnimation[] anims string optionAggressive = "" if playerVictim || partnerVictim || aggressive optionAggressive = ",Aggressive" EndIf If type == "Aggressive" anims = SexLab.GetAnimationsByTags(2, "Aggressive") ElseIf type == "Any" If playerGender != partnerGender ;straight sex If SSv3MCM.op_StraightContextual == true int rollDice = Utility.RandomInt(1,100) If rollDice < 50 anims = SexLab.GetAnimationsByTags(2, "Vaginal"+optionAggressive) ElseIf rollDice < 80 anims = SexLab.GetAnimationsByTags(2, "Anal"+optionAggressive) Else anims = SexLab.GetAnimationsByTags(2, "Oral"+optionAggressive) EndIf Else anims = SexLab.GetAnimationsByTags(2, "Sex"+optionAggressive) EndIf ElseIf (playerGender == 1 && partnerGender == 1) ;lesbian sex if playerVictim || partnerVictim || aggressive ;rape or rough sex, pick any aggressive anim including strap-on ones anims = SexLab.GetAnimationsByTags(2, "Aggressive") Else ;consensual If SSv3MCM.op_LesbianContextual == true anims = SexLab.GetAnimationsByTags(2, "Lesbian") Else anims = SexLab.GetAnimationsByTags(2, "Sex"+optionAggressive) EndIf EndIf Else ;gay sex If SSv3MCM.op_GayContextual == true int rollDice = Utility.RandomInt(1,100) If rollDice < 50 anims = SexLab.GetAnimationsByTags(2, "Blowjob"+optionAggressive) Else anims = SexLab.GetAnimationsByTags(2, "Anal"+optionAggressive) EndIf Else anims = SexLab.GetAnimationsByTags(2, "Sex"+optionAggressive) EndIf EndIf ElseIf type == "Vaginal" anims = SexLab.GetAnimationsByTags(2, "Vaginal"+optionAggressive) ElseIf type == "Anal" anims = SexLab.GetAnimationsByTags(2, "Anal"+optionAggressive) ElseIf type == "Oral" If context == "pleasuring" || playerVictim If partnerGender == 0 ;suppress 69 anim, since this context is strictly sexual favour for male NPC anims = SexLab.GetAnimationsByTags(2, "Blowjob"+optionAggressive, "69") Else anims = SexLab.GetAnimationsByTags(2, "Oral,FF") EndIf ElseIf context == "pleasured" || partnerVictim If playerGender == 0 ;suppress 69 anim, since this context is strictly sexual favour for male player anims = SexLab.GetAnimationsByTags(2, "Blowjob"+optionAggressive, "69") Else anims = SexLab.GetAnimationsByTags(2, "Oral,FF") EndIf ElseIf context == "mutual" If playerGender != partnerGender ;straight sex: pick any oral anims = SexLab.GetAnimationsByTags(2, "Oral"+optionAggressive) ElseIf (playerGender == 1 && partnerGender == 1) ;lesbian sex: FF only (disqualify blowjobs/etc) anims = SexLab.GetAnimationsByTags(2, "Oral,FF") ElseIf (playerGender == 0 && partnerGender == 0) ;gay sex: disallow lesbian anims = SexLab.GetAnimationsByTags(2, "Oral"+optionAggressive, "Lesbian") EndIf EndIf Else ;requested type not recognized by Stage 4, attempt to fetch anims with parameter 'type' anims = SexLab.GetAnimationsByTags(2, type+optionAggressive) EndIf If anims == None || anims.Length == 0 ;parameter 'type' unrecognized by SexLab, pick from full anim list anims = SexLab.GetAnimationsByType(2) Debug.MessageBox("SexLab Solutions Warning code 1000 : Failed to generate context-specific animation list. Using full animation list.") EndIf ;STAGE 5 - Execute SexLab thread Model.SetAnimations(anims) Model.StartThread() EndFunction SSv2_TIF__0301B529: ;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment ;NEXT FRAGMENT INDEX 2 Scriptname SSv2_TIF__0301B529 Extends TopicInfo Hidden ;BEGIN FRAGMENT Fragment_0 Function Fragment_0(ObjectReference akSpeakerRef) Actor akSpeaker = akSpeakerRef as Actor ;BEGIN CODE SSv2Quest.CarlottaSex = 1 ;END CODE EndFunction ;END FRAGMENT ;BEGIN FRAGMENT Fragment_1 Function Fragment_1(ObjectReference akSpeakerRef) Actor akSpeaker = akSpeakerRef as Actor ;BEGIN CODE Handler.SexForTwo(akSpeaker, context="mutual", type="Any") ;END CODE EndFunction ;END FRAGMENT ;END FRAGMENT CODE - Do not edit anything between this and the begin comment ssv2questscript Property SSv2Quest Auto SSv3Handler Property Handler Auto
Ashal Posted January 18, 2015 Posted January 18, 2015 I'm assuming (hoping) that's not how the file is actually formatted and the copy/paste or forum just butchered it. If so, could you instead attach the .psc itself? The excessive amount of if/else nesting you're doing is making it real hard to tell what you're doing at a glance, a version with the proper indentation would make things much easier.
WraithSlayer Posted January 18, 2015 Author Posted January 18, 2015 I'm assuming (hoping) that's not how the file is actually formatted and the copy/paste or forum just butchered it. If so, could you instead attach the .psc file in a zip file? The excessive amount of if/else nesting you're doing is making it real hard to tell what you're doing at a glance, a version with the proper indentation would make things much easier. Haha yes, sorry about that. Attaching the .PSC files. And I realize there are a lot of redundant if/else there, but that's something I'll take care of later. SSv2_TIF__0301B529.psc SSv3Handler.psc
Ashal Posted January 18, 2015 Posted January 18, 2015 I don't see anything obviously wrong. Though I find it to be a strange error if you are 100% positive that the animation that plays afterward is indeed limited to the chosen animation set. I haven't a clue what causes it, at least not directly. I know ZazAnimations commonly produces a similar error during game load. I haven't yet bothered to check why it happens there, but in current development builds of SexLab I've changed the animation functions to return a 0 length array instead of a none, thus preventing the error from ZazAnimations, and very likely also from your own mod. I have however done zero testing on how backwards compatible that change is with current versions of SexLab.
WraithSlayer Posted January 18, 2015 Author Posted January 18, 2015 I don't see anything obviously wrong. Though I find it to be a strange error if you are 100% positive that the animation that plays afterward is indeed limited to the chosen animation set. I haven't a clue what causes it, at least not directly. I know ZazAnimations commonly produces a similar error during game load. I haven't yet bothered to check why it happens there, but in current development builds of SexLab I've changed the animation functions to return a 0 length array instead of a none, thus preventing the error from ZazAnimations, and very likely also from your own mod. I have however done zero testing on how backwards compatible that change is with current versions of SexLab. Yes, I tested it for several scenarios and it seems to always match the intended animation set, both in the Papyrus log and in-game when cycling through animations. I do have a last-resort GetAnimationsByType() in the script, but it also outputs a warning MessageBox in that scenario, and that's not happening in my tests, so anims is somehow getting filled in the exact line where the error is occuring. I am assuming it might have something to do with the anims array not being initialized (and hence still None) when the GetAnimationsByTag() function returns its result into it. I noticed other mods seem to always fill the array right at declaration time, such as sslBaseAnimation[] anims = SexLab.GetAnimationsByTags(2, "Lesbian") instead of declaring the array in one instruction, and assigning it in another, like my script is doing.
Ashal Posted January 18, 2015 Posted January 18, 2015 I don't see anything obviously wrong. Though I find it to be a strange error if you are 100% positive that the animation that plays afterward is indeed limited to the chosen animation set. I haven't a clue what causes it, at least not directly. I know ZazAnimations commonly produces a similar error during game load. I haven't yet bothered to check why it happens there, but in current development builds of SexLab I've changed the animation functions to return a 0 length array instead of a none, thus preventing the error from ZazAnimations, and very likely also from your own mod. I have however done zero testing on how backwards compatible that change is with current versions of SexLab. Yes, I tested it for several scenarios and it seems to always match the intended animation set, both in the Papyrus log and in-game when cycling through animations. I do have a last-resort GetAnimationsByType() in the script, but it also outputs a warning MessageBox in that scenario, and that's not happening in my tests, so anims is somehow getting filled in the exact line where the error is occuring. I am assuming it might have something to do with the anims array not being initialized (and hence still None) when the GetAnimationsByTag() function returns its result into it. I noticed other mods seem to always fill the array right at declaration time, such as sslBaseAnimation[] anims = SexLab.GetAnimationsByTags(2, "Lesbian") instead of declaring the array in one instruction, and assigning it in another, like my script is doing. Debug.Trace() your anims array before and after the GetAnimationsByTags() call, the stringified contents may be telling. Is it happening repeatedly on all function calls, or ONLY on this one line you've provided example for with the lesbian tag? Which by the way, is a bad tag to search for, if you want a lesbian animation, search for "FF", not "Lesbian". Lesbian is a non-standard tag, while FF is a standard, automatic tag for female+female animation, regardless of default tagging.
WraithSlayer Posted January 18, 2015 Author Posted January 18, 2015 Debug.Trace() your anims array before and after the GetAnimationsByTags() call, the stringified contents may be telling. Is it happening repeatedly on all function calls, or ONLY on this one line you've provided example for with the lesbian tag? Which by the way, is a bad tag to search for, if you want a lesbian animation, search for "FF", not "Lesbian". Lesbian is a non-standard tag, while FF is a standard, automatic tag for female+female animation, regardless of default tagging. Thanks for the tag advice, I'll change those to FF. Yes, it seems to be happening every time for every function call I'm making via this handler. I followed your suggestion to trace the array's contents, and frankly I'm even more confused now. The test version of the script I used is attached below, I tested it with a blowjob scene this time. The important bits are on lines 176 to 190. This is what the log output gave me: [01/18/2015 - 03:21:24PM] SexLab: Making thread[0] [sslThreadController <alias ThreadView014 on quest SexLabQuestThreadSlots (1003CE6E)>] [01/18/2015 - 03:21:24PM] SexLab Thread[0] ModEvent: ThreadOpened [01/18/2015 - 03:21:24PM] -- SexLab ActorAlias -- Thread[0] Slotted 'Brenuin' into alias -- [sslactoralias <alias ActorSlot074 on quest SexLabQuestActorSlots (1003CE6B)>] [01/18/2015 - 03:21:25PM] -- SexLab ActorAlias -- Thread[0] Slotted 'Prisoner' into alias -- [sslactoralias <alias ActorSlot073 on quest SexLabQuestActorSlots (1003CE6B)>] [01/18/2015 - 03:21:25PM] SexLab Thread[0] ModEvent: PlayerAdded [01/18/2015 - 03:21:25PM] SSv3Test: DEBUG STARTED [01/18/2015 - 03:21:25PM] SSv3Test: anims[] Length before assign is: 0 [01/18/2015 - 03:21:25PM] --- SexLab Animation Search ------------------------------ [01/18/2015 - 03:21:25PM] GetByTags(2, ["Blowjob"], ["69"], TRUE) [01/18/2015 - 03:21:25PM] Found [6] Animations: Arrok Blowjob, AP Blowjob, AP Kneeling Blowjob, AP Standing Blowjob, AP Skull Fuck, DI Blowjob, [01/18/2015 - 03:21:25PM] ---------------------------------------------------------- [01/18/2015 - 03:21:25PM] SSv3Test: anims[] Length after assign is: 6 [01/18/2015 - 03:21:25PM] SSv3Test: After: anims[0] content: [sslbaseanimation <alias AnimationSlot040 on quest SexLabQuestAnimationSlots (1003CE6C)>] [01/18/2015 - 03:21:25PM] SSv3Test: After: anims[1] content: [sslbaseanimation <alias AnimationSlot065 on quest SexLabQuestAnimationSlots (1003CE6C)>] [01/18/2015 - 03:21:25PM] SSv3Test: After: anims[2] content: [sslbaseanimation <alias AnimationSlot067 on quest SexLabQuestAnimationSlots (1003CE6C)>] [01/18/2015 - 03:21:25PM] SSv3Test: After: anims[3] content: [sslbaseanimation <alias AnimationSlot068 on quest SexLabQuestAnimationSlots (1003CE6C)>] [01/18/2015 - 03:21:25PM] SSv3Test: After: anims[4] content: [sslbaseanimation <alias AnimationSlot069 on quest SexLabQuestAnimationSlots (1003CE6C)>] [01/18/2015 - 03:21:25PM] SSv3Test: After: anims[5] content: [sslbaseanimation <alias AnimationSlot071 on quest SexLabQuestAnimationSlots (1003CE6C)>] [01/18/2015 - 03:21:25PM] SSv3Test: DEBUG FINISHED [01/18/2015 - 03:21:25PM] Error: Cannot cast from None to sslbaseanimation[] stack: [SSv2System (83002386)].SSv3Handler.SexForTwo() - "SSv3Handler.psc" Line 190 [topic info 83003492 on quest SSv2System (83002386)].ssv2_tif__03003492.Fragment_2() - "ssv2_tif__03003492.psc" Line 18 [01/18/2015 - 03:21:25PM] SexLab Thread[0] ModEvent: AnimationStart // PlayerAnimationStart Something either has to be seriously fucky here, or I'm making some outlandish mistake. The trace outputs do indicate that the array was empty before GetAnimationsByTags(), and it was filled with 6 animations right after, which is good, that's exactly what it's meant to be doing. However, if you look at the error in the log, nothing adds up. Firstly, the error pops up after all the debug lines are done, including the ones that are printed after the anims array is filled, and secondly, it says the problem is in line 190, which, in this test version of the script, is nothing more than Debug.Trace("SSv3Test: DEBUG FINISHED") How is a simple Debug.Trace causing a cast error involving a sslbaseanimation[]? It sounds so baffling that I was sure that I had messed up somehow, and was using the wrong version of the script for testing... but I recompiled and triple-checked: the PSC attached to this post is the one used to generate the PEX that created that log file. There has to be something seriously wrong in the script that's causing Papyrus to glitch and output that error. I'm going to comment out large sections of it and just try creating a simple scene with none of the nested Ifs, and see if it still happens. SSv3Handler.psc
WraithSlayer Posted January 18, 2015 Author Posted January 18, 2015 Yup, there's no error if I just make simple SexLab thread. I'll figure out the source of the problem by trial and error.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.