Jump to content

SkyUI MCM problem (Scripting)


Guest GuyWhoAbruptlyDisappeared

Recommended Posts

Guest GuyWhoAbruptlyDisappeared
Posted

Hi,

 

I am working on the MCM (finally) for Sexlab Mortality, and it's going well, except for one problem - My sliders, despite having set the range from -1.0 to 300 in the script, only go from 0 to 1. Does anyone know what I am doing wrong here?

 

This is the relevant part of the code. 

 


GlobalVariable property dKG auto
GlobalVariable property sOKG auto
GlobalVariable property vKG auto
GlobalVariable property uKG auto
float dK
float sOK
float vK
float uK
int d
int so
int v
int u
 
event OnPageReset(string JesusChrist)

 SetCursorFillMode(TOP_TO_BOTTOM)
 dK = dKG.GetValue() 
 vK = vKG.GetValue() 
 sOK = sOKG.GetValue() 
 uK = uKG.GetValue() 
 AddHeaderOption("Key Configuration")
 SetCursorPosition(2)
 d = AddSliderOption("Depression Key", 50)
 so = AddSliderOption("Strap-On Key", 20)
 v = AddSliderOption("Victim Key", 30)
 u = AddSliderOption("Untrusted Key", 50)
endEvent
 

event OnSliderOpen(int op)
 if op == d
  SetSliderDialogStartValue(dK)
  setSliderDialogDefaultValue(25)
  setSliderDialogRange(-1.0, 300.0)
  setSliderDialogInterval(1.0)
 elseIf op == so
  SetSliderDialogStartValue(sOK)
  setSliderDialogDefaultValue(20)
  setSliderDialogRange(-1.0, 300.0)
  setSliderDialogInterval(1.0)
 elseIf op == v
  SetSliderDialogStartValue(vK)
  setSliderDialogDefaultValue(30)
  setSliderDialogRange(-1.0, 300.0)
  setSliderDialogInterval(1.0)
 elseIf op == u
  SetSliderDialogStartValue(uK) 
  SetSliderDialogDefaultValue(50)
  setSliderDialogRange(-1.0, 300.0)
  SetSliderDialogInterval(2)
 endIf

endEvent

 
event onOptionSliderAccept(int op, float val)
 if op == d
  dK = val
  SetSliderOptionValue(d, dK)
  dKG.SetValue(val)
 elseIf op == so
  sOK = val
  SetSliderOptionValue(so, sOK)

  sOKG.SetValue(val)
 elseIf op == v
  vK = val
  SetSliderOptionValue(v, vK)
  vKG.SetValue(val)
 elseIf op == u
  uK = val
  SetSliderOptionValue(u, uK)
  uKG.SetValue(val)
 endIf
endEvent

Posted

Yeah, I can see the problem right away. You are actually making things significantly more difficult on yourself. I suggest using states instead, it will make your life MUCH, MUCH easier.

 

I'll be back in a second to show you how something like that would look.

 

*Edit* Admittedly, my code is a lot more fragmented because of how I use functions for doing a lot of the heavy lifting, but this is the gist of how I populate MCM options.

 

 

Function HandleOptionsMenuFemale()
SetCursorFillMode(LEFT_TO_RIGHT)

AddHeaderOption("Mod Status")
AddEmptyOption()

AddEmptyOption()
AddEmptyOption()

AddHeaderOption("Arousal Options")
AddEmptyOption()

AddSliderOptionST("ArousalEventRateSlider", "Arousal Event Polling:", ArousalEventRate, TimeRateFormatting)
AddSliderOptionST("MinorArousalRateSlider", "Minor Arousal Event Chance:", MinorArousalEventChance, EventChanceFormatting)

AddSliderOptionST("MajorArousalRateSlider", "Major Arousal Event Chance:", MajorArousalEventChance, EventChanceFormatting)
AddEmptyOption()

AddEmptyOption()
AddEmptyOption()

AddHeaderOption("Appearence (Debug)")
AddEmptyOption()

If(EarsActive)
AddToggleOptionST("AddEarsState", "Add Ears:", false)
Else
AddToggleOptionST("AddEarsState", "Add Ears:", false, OPTION_FLAG_DISABLED)
EndIf

If(TailActive)
AddToggleOptionST("AddTailState", "Add Tail:", false)
Else
AddToggleOptionST("AddTailState", "Add Tail:", false, OPTION_FLAG_DISABLED)
EndIf

If(HybridFurActive)
AddToggleOptionST("AddHybridArmorState", "Add Hybrid Fur:", false)
Else
AddToggleOptionST("AddHybridArmorState", "Add Hybrid Fur:", false, OPTION_FLAG_DISABLED)
EndIf
AddEmptyOption()

AddHeaderOption("Uninstallation")
AddEmptyOption()

If(!cleanupTriggered)
AddToggleOptionST("Cleanup", "Prepare for Uninstallation:", cleanupTriggered)
Else
AddToggleOptionST("Cleanup", "Prepare for Uninstallation:", cleanupTriggered, OPTION_FLAG_DISABLED)
EndIf
AddEmptyOption()
EndFunction

 

 

Then, for actually handling a state option, you would use code like this.

 

 

State ArousalEventRateSlider
Event OnHighlightST()
SetInfoText("How often an arousal event has a chance to occur.")
EndEvent

Event OnDefaultST()
ArousalEventRate = 1.0
SetSliderOptionValueST(ArousalEventRate, TimeRateFormatting)
EndEvent

Event OnSliderOpenST()
SetSliderDialogStartValue(ArousalEventRate)
SetSliderDialogDefaultValue(1.0)
SetSliderDialogRange(1.0, 24.0)
SetSliderDialogInterval(0.1)
EndEvent

Event OnSliderAcceptST(float value)
ArousalEventRate = value
SetSliderOptionValueST(ArousalEventRate, TimeRateFormatting)
EndEvent
EndState

 

 

Thats actually code from SLB's mcm.

Posted

"event OnPageReset(string JesusChrist)"

Clearly the JesusChrist argument is not enough.

string JesusChristSuperStar, this might work

 

I don't think it matters, but I'd also try OnOptionSliderOpen instead of OnSliderOpen

Guest GuyWhoAbruptlyDisappeared
Posted

"event OnPageReset(string JesusChrist)"

Clearly the JesusChrist argument is not enough.

string JesusChristSuperStar, this might work

 

I don't think it matters, but I'd also try OnOptionSliderOpen instead of OnSliderOpen

 

Yep, that was the problem. Didn't see that. Thanks.

 

I switched it to JesusChristSuperStar and it works fine. I should have read that OnOptionSliderOpen requires a holy bonus of 26 or higher. 

Archived

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

  • Recently Browsing   0 members

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