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

Conditional loop doesn't work

markdomx [ Thu Oct 27, 2016 1:35 pm ]

Hi everybody. A new problem: in my script slave can repeat an exercise with the opportunity to ask for mercy.
BUT mistress can say no and then slave must continue the same routine without any button to ask....
My code doesn't work....why?

Code:
//EXERCISE NO MERCY
def exercisenomercy = {
........
}

//-------------------------------------------

//EXERCISE WITH MERCY
def exerciseyesmercy = {
........
def tempo = getRandom(2)+3
def time = showButton("Please stop!", tempo)
}

//-------------------------------------------

//MISTRESS DECISION
def decision = {
def yesno = getRandom(2)
switch (yesno) {
case 0: def mercy = 1
default: def mercy = 0
}

//-------------------------------------------


(1..10).each {
switch (mercy) {
case 0: exerciseyesmercy()
default: exercisenomercy()
}
//-------------------------------------------

Re: Conditional loop doesn't work

doti [ Thu Oct 27, 2016 1:46 pm ]

Some closing } must be missing here, but the main thing is : mercy is defined local here (inside some {} ), so can not be read later.
Start with a definition that is not in {}
Code:
def mercy

Then change it only
Code:
case 0: mercy = 1

And it should work

Re: Conditional loop doesn't work

markdomx [ Thu Oct 27, 2016 2:57 pm ]

I have found the solution:

(1..10).each {
switch (calzatolta) {
case 0: exercisewithmercy()
....}
break

default: exercisewithnomercy()
}
}

In this way script repeat the switch action....
Thank you doti!

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