Jump to content

SexLab timers and message boxes


Recommended Posts

First: What do want to do? I would like to display messages on the screen every time a specific SexLab animation enters a new stage.
 
How did I try to do that? With this (relevant parts only):
 

Function StartSex()
  sslBaseAnimation[] anis = new sslBaseAnimation[1]
  sslThreadModel thread = SexLab.NewThread()
  thread.AddActor(Giver)
  thread.AddActor(Receiver)
  anis[0] = SexLab.GetAnimationByName("Leito Blowjob")
  thread.SetHook("SexBlowjob")
  RegisterForModEvent("StageStart_SexBlowjob", "BJ_StageStart")
  thread.StartThread()
EndFunction
 
Event BJ_StageStart(String EventName, String ArgString, Float ArgNum, Form Sender)
  int Stage = SexLab.HookController(ArgString).Stage

  if Stage == 1
    Message01.Show()
  elseif Stage == 2
    Message02.Show()
  [...]
EndEvent   

 
 
This works in the sense that I do get the correct messages whenever a new stage is started. The problem seems to be the asynchronous nature of the code execution. The message boxes do not freeze the SexLab timers. While the user is still reading the message, the animation timer keeps ticking in the background. So if the user takes too long to read, by the time they click "Ok", the stage is immediately over and the next stage is entered.
 
So far, the only possible workaround I have come up with is to use custom timers. If I set those to ridiculously high values, the probability of the player taking too much time to read the message boxes decreases. And if they finish reading in a normal amount of time, they'd have to manually advance the stage with the space key.
 
Is there a better - or even official - way to do it?

Link to comment

Hi,

 

Have you had a look at Apropos yet? It does something similar, though without pausing the game. The messages are displayed through a widget.

 

And this may be an utterly rubbish idea, but could you fire something like the console command "tfc 1" during the time the messages pop up, and fire it again on clicking OK? If there is a script equivalent for it? I used it every now and then to take screenshots when I started modding my game but I don't remember if there were any issues with the SL scenes.

Link to comment

Have you had a look at Apropos yet? It does something similar, though without pausing the game. The messages are displayed through a widget.

I didn't know about that mod, so thanks for pointing it out to me. However, it works slightly different than what I want.

 

Apropos doesn't have the problem I described because it doesn't block the game. The messages are displayed while the sex scene is going on. This forces the player to divert their attention between reading the message and watching the actors having sex.

 

What I think would be better is to show a message box that you have to click away. And then you see a bit of sex happening. And then you have to click away another message. While it may seem annoying that you have to click away those message boxes, the advantage is that you never have to divert your attention between two things happening at the same time. It's always message -> sex -> message -> sex.

 

To me, that seems preferable. But I don't know how to stop the timers running in the background while the message box is on the screen.

 

 

And this may be an utterly rubbish idea, but could you fire something like the console command "tfc 1" during the time the messages pop up, and fire it again on clicking OK? If there is a script equivalent for it? I used it every now and then to take screenshots when I started modding my game but I don't remember if there were any issues with the SL scenes.

 

I might use ConsoleUtil for that, but I don't see how that helps my problem. Even with the free camera, the SexLab timers keep ticking while the message box is displayed.

Link to comment
...

I might use ConsoleUtil for that, but I don't see how that helps my problem. Even with the free camera, the SexLab timers keep ticking while the message box is displayed.

 

Not precisely, using the command "tfc 1" freezes the game until the same command is input again. So you can freeze any moment in the game, just before impact of the weapon/spell for example, move the camera around and take a cool 'action screenshot' (or do whatever). I'm not 100% certain, but I think the Sexlab scenes/timers also freeze until "tfc 1" gets entered again and then continued as normal.

Link to comment

Not precisely, using the command "tfc 1" freezes the game until the same command is input again.

Tried it (manually), didn't affect SexLab. The actors are all frozen, but you can still hear the moaning and all that stuff. And the stages still progress in the background. Kind of like the freeze frame button on the TV. The regular program keeps broadcasting and when you unfreeze, you're immediately at the current position in the stream.

Link to comment

 

Tried it (manually), didn't affect SexLab. The actors are all frozen, but you can still hear the moaning and all that stuff. And the stages still progress in the background. Kind of like the freeze frame button on the TV. The regular program keeps broadcasting and when you unfreeze, you're immediately at the current position in the stream.

 

Bummer! Sorry for leading you on the wrong track. I was sure that I had used it before but I must have totally missed that the scenes were playing on in the background. So it just remains a good feature for 'battle action' screenshots or to use as a cheat, to try and get a better understanding of the surroundings during battle for instance.

Link to comment

Can you do something like this?

 

if (messagebox 1 is open) && (stage > 1)

    set stage to 1

if (messagebox 2 is open) && (stage > 2)

    set stage to 2

 

That sort of thing, i.e. force the stage to go backwards if your current messagebox is still open?

 

 

I can't do exactly that, but it did put me on the right track. The SexLab ThreadController has a function to set the stage. And that function happens to reset the timer. So the idea is: You just remember the current stage, show the message and then go to that very same stage. Thus resetting the timer.

 

In practise, you'd end up with an infinite loop (enter stage 1 -> event handler is called -> shows message -> re-enter stage 1 -> event handler called (again) -> shows the message again -> re-enter stage 1 -> and so on). So you also have to remember if you already did your stuff for this stage and then just let everything proceed as normal.

 

In code, it looks like this:

 

int CurrentSexStage = -1
int OldSexStage = -1
 
Event BJ_StageStart(String EventName, String ArgString, Float ArgNum, Form Sender)
  SSLThreadController Controller = SexLab.HookController(ArgString)
    
  CurrentSexStage = Controller.Stage
    
  if CurrentSexStage > OldSexStage ; Only if this is the first time we reach this stage!
    OldSexStage = CurrentSexStage
    if CurrentSexStage == 1
      Message01.Show()
    elseif CurrentSexStage == 2
      Message02.Show()
    [...]
    endif
    Controller.GoToStage(CurrentSexStage)
  endif
EndEvent

According to my preliminary tests, this seems to work. If there are no better suggestions or unforeseen issues, or someone can tell me why it's a bad idea to do it this way, I think that's it.

 

Thanks to everyone who answered!

Link to comment

Archived

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

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use