SexScripts : Switch doesn't work - https://ss.deviatenow.com:443/viewtopic.php?f=4&t=693 Page 1 of 1

Switch doesn't work

Vallay [ Wed Jun 21, 2017 3:42 am ]

Hey, I'm new here and I just tried to make a script, but it doesn't work how I expected it to do.
This is a test form of my script (has the same form as the final product should have, but with less content)
Code:
   setImage("Own Images/Fag Roulette/Roulette Master.jpg")
   show("Hello there, faggot!")
   showButton("Hello, Sir")
   show("Are you ready for the Fag-Roulette?")
   showButton("Of course")
   show("Great, I haven't expected anything different so let's start!")
   showButton("Get your random category")
   def spin_category = [ "Anal", "Chastity", "Cum", "Cumplay", "Dildo", "Humiliation", "Masturbation", "No_Cum", "Proof", "Public" ]
   show(spin_category [getRandom(10) ])
   wait(10)
   switch (spin_category) {
      case "Anal":
         show("Test1")
         break
      case "Chastity":
         show("Test2")
         break   
      case "Cum":
         show("Test3")
         break   
      case "Cumplay":
         show("Test4")
         break   
      case "Dildo":
         show("Test5")
         break   
      case "Humiliation":
         show("Test6")
         break   
      case "Masturbation":
         show("Test7")
         break   
      case "No_Cum":
         show("Test8")
         break   
      case "Proof":
         show("Test9")
         break   
      case "Public":
         show("Test10")   
   }

My problem: I can click the buttons and it shows me one of the 10 categories but in case of switching to the "case" it just ends there ... I tried so much, could anyone help me? (I'm not really experienced and tried it with the help of the manual, so a easy explanation would be good :D)

Re: Switch doesn't work

doti [ Wed Jun 21, 2017 8:28 am ]

It should be something like :
Code:
...
wait(10)
   switch (spin_category[getRandom(10)]) {
      case "Anal":
...

or more probably:
Code:
...
def choice = spin_category [getRandom(10) ]
show(choice)
   wait(10)
   switch (choice) {
      case "Anal":
...

Re: Switch doesn't work

Vallay [ Wed Jun 21, 2017 1:37 pm ]

doti wrote:
It should be something like :
Code:
...
wait(10)
   switch (spin_category[getRandom(10)]) {
      case "Anal":
...

or more probably:
Code:
...
def choice = spin_category [getRandom(10) ]
show(choice)
   wait(10)
   switch (choice) {
      case "Anal":
...


First of all, thank you :)
I tried your first version and it works now, but there is still some problem but I don't know why:
Sometimes when I get for example the first category it doesn't show me the text of the first one but of another one (e.g. the third category).
Do you know where this could come from?
would the second one be a better option then?

Re: Switch doesn't work

doti [ Wed Jun 21, 2017 1:40 pm ]

Yes, the second one is a better option : the 1st one call 2 times getRandom(), so both numbers can be different.

Re: Switch doesn't work

Vallay [ Wed Jun 21, 2017 2:05 pm ]

doti wrote:
Yes, the second one is a better option : the 1st one call 2 times getRandom(), so both numbers can be different.

Okay thank you in advance :D
I will try it later and if it shouldn't work I write again.
So if you don't hear from me again: Thank you very much :*

Page 1 of 1 All times are UTC + 1 hour [ DST ]
https://ss.deviatenow.com:443/
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Maroon Fusion theme created by Oxydo
Software, theme modifications, phpBB modification by Doti 2010, 2011