Jump to content

SexLab scripting: adding event error


Recommended Posts

Posted

Hi! I followed SexLab tutorials, where you can start sex animation from dialogue topic. I put the code inside the fragment, and everything worked well in the game. However when I then wanted to extend the script adding an event on animation ending, it turned out events do not work inside fragments.

 

So I tried instead to create a script without this fragment structure, adding sexlab property and all, but it doesn't seem to work..

I get this no viable alternative at input 'sexlab'

required (...)+ loop did not match anything at input '

Unknown user flag sexlab
error messages at third line
 

 

Please help

 

 

Scriptname Myscript extends TopicInfo

 

SexLabFramework property sexlab auto

 

sslThreadModel AnimationObject = SexLab.NewThread()

 

AnimationObject.AddActor(Game.GetPlayer(), isVictim = false)

AnimationObject.AddActor(akSpeaker, isVictim = false)

sslBaseAnimation[] anims

anims = new sslBaseAnimation[1]

anims[0] = SexLab.GetAnimationByName("Arrok Lesbian")

AnimationObject.SetAnimations(anims)



RegisterForModEvent("HookAnimationEnd", "AnimationEnd")



AnimationObject.StartThread()

 

event AnimationEnd(int ThreadId, bool HasPlayer)

 sslThreadController thread = SexLab.GetController(ThreadID)

 Actor[] actors = thread.positions

 

 int it = positions.length

 while i > 0

  i -= 1

  Debug.notification(position.GetLeveledActorBase().GetName() + "could use a cigarette")

 endWhile

endEvent

 

 

 

Posted

You can't use events with fragments. Soon as the fragment script finishes running the script thread itself terminates so there it no longer exists to receive your AnimationEnd event.

 

Easiest way around this is to setup a seperate script that is attached to the quest your mods dialog is setup in, then create a function to start the animation and receive the event. With that setup you'd simply call your custom quest script function to do all the work from within your script fragment.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...