de en es fr
Let the machine help
Light teasing, exhibition, BDSM, sissyfication, watersports... with sounds and pictures


Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Multiple IFs in an IF/ELSE statement.
PostPosted: Thu Jul 25, 2013 5:53 am 
Offline
Regular
This is what I've got...
Code:
def spanishexample = getString("Tell me that you are a slut.", "Remember, punctuation and capitals are important.");

if(spanishexample == "I am a slut.") {
   show("¡Perfecto!  Good work, slut.  You may massage your cock.");
}
if(spanishexample == "i am a slut.") {
   show("Alright, alright.  You might be under the impression to uncapitalize 'I' when referring to youself, but you will not do that here.  This is a class about proper grammar, not proper slave grammar. Pinch your nipples. ");
}
if(spanishexample == "I am a slut") {
   show("You forgot to put a period at the end of your sentence, slut.  Slap your face, hard.");
}
if(spanishexample == "I am a slut, Mistress.") {
   show ("You even threw in a Mistress, good job!  I like my sluts to be respectful, haha.  Go ahead and tug yourself off for a bit.");
}
else {
   show("Well, you fucked up.  Face down, ass in the air.\n\n Now spank yourself 10 times for each character that is different from the phrase 'I am a slut.'  You wrote '"+spanishexample+"'");
}
showButton("Finished, Mistress")


All of the if statements, except the if(spanishexample == "I am a slut, Mistress."), show both their text, and the text from the else box.

Any ideas why, and how to go about fixing it?


Top
 Profile Send private message 
 
 Re: Multiple IFs in an IF/ELSE statement.
PostPosted: Thu Jul 25, 2013 6:31 pm 
Offline
Site Admin
User avatar
Probably this solution, adding some "else" :
Code:
if(spanishexample == "I am a slut.") {
   show("¡Perfecto!  Good work, slut.  You may massage your cock.");
}
else if(spanishexample == "i am a slut.") {
   show("Alright, alright.  You might be under the impression to uncapitalize 'I' when referring to youself, but you will not do that here.  This is a class about proper grammar, not proper slave grammar. Pinch your nipples. ");
}
else if(spanishexample == "I am a slut") {
   show("You forgot to put a period at the end of your sentence, slut.  Slap your face, hard.");
}
else if(spanishexample == "I am a slut, Mistress.") {
   show ("You even threw in a Mistress, good job!  I like my sluts to be respectful, haha.  Go ahead and tug yourself off for a bit.");
}
else {
   show("Well, you fucked up.  Face down, ass in the air.\n\n Now spank yourself 10 times for each character that is different from the phrase 'I am a slut.'  You wrote '"+spanishexample+"'");
}
showButton("Finished, Mistress")



Top
 Profile Send private message 
 
 Re: Multiple IFs in an IF/ELSE statement.
PostPosted: Fri Jul 26, 2013 3:49 am 
Offline
Regular
Sweet, I'll give it a shot. Thanks!

That worked perfectly. I have a new problem though, whenever I try to publish this script, I get this error:

Error java.io.IOException: Premature EOF


Top
 Profile Send private message 
 
 Re: Multiple IFs in an IF/ELSE statement.
PostPosted: Fri Jul 26, 2013 8:45 pm 
Offline
Site Admin
User avatar
Can you write here the 30 or 40 last lines of the file "errors.log" ?


Top
 Profile Send private message 
 
 Re: Multiple IFs in an IF/ELSE statement.
PostPosted: Sat Jul 27, 2013 11:42 pm 
Offline
Regular
Code:
Sat Jul 27 15:40:49 MDT 2013
os.name : Windows 7
os.arch : x86
java.version : 1.7.0_05
java.io.IOException: Premature EOF
   at sun.net.www.http.ChunkedInputStream.fastRead(Unknown Source)
   at sun.net.www.http.ChunkedInputStream.read(Unknown Source)
   at java.io.FilterInputStream.read(Unknown Source)
   at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(Unknown Source)
   at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
   at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
   at sun.nio.cs.StreamDecoder.read(Unknown Source)
   at java.io.InputStreamReader.read(Unknown Source)
   at java.io.BufferedReader.fill(Unknown Source)
   at java.io.BufferedReader.readLine(Unknown Source)
   at java.io.BufferedReader.readLine(Unknown Source)
   at ss.Publisher.doPublish(Publisher.java:429)
   at ss.Publisher.execute(Publisher.java:109)
   at ss.EditorFrame$8.actionPerformed(EditorFrame.java:235)
   at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
   at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
   at javax.swing.AbstractButton.doClick(Unknown Source)
   at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
   at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
   at java.awt.Component.processMouseEvent(Unknown Source)
   at javax.swing.JComponent.processMouseEvent(Unknown Source)
   at java.awt.Component.processEvent(Unknown Source)
   at java.awt.Container.processEvent(Unknown Source)
   at java.awt.Component.dispatchEventImpl(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Window.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
   at java.awt.EventQueue.access$000(Unknown Source)
   at java.awt.EventQueue$3.run(Unknown Source)
   at java.awt.EventQueue$3.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue$4.run(Unknown Source)
   at java.awt.EventQueue$4.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)


Top
 Profile Send private message 
 
 Re: Multiple IFs in an IF/ELSE statement.
PostPosted: Sun Jul 28, 2013 8:15 am 
Offline
Regular
User avatar
I would put the last line is as something like this.
Note, this uses an If/or. I'm not sure if they can be done in groovy, but if they can, it's probably like this.

Code:
if((spanishexample != "I am a slut.") || (spanishexample != "i am a slut.") || (spanishexample != "i am a slut") || (spanishexample != "I am a slut, Mistress"))
{
   show("Well, you fucked up.  Face down, ass in the air.\n\n Now spank yourself 10 times for each character that is different from the phrase 'I am a slut.'  You wrote '"+spanishexample+"'");
}


This should return true if it's not one of the above. I'm really not sure if this will work or not, I haven't found anything about 'or' in the looking I've done. I've seen things for 'and' which uses the familiar syntax of &&. I'm used to or syntax being ||.
This may work, it may not.

edit;
I can confirm that both && as well as || work.
I've also figured your issue, however it should've been AND instead of OR anyway.

This code should work for you.

Code:
def spanishexample = getString("Tell me that you are a slut.", "Remember, punctuation and capitals are important.");

if(spanishexample == "I am a slut.") {
   show("¡Perfecto!  Good work, slut.  You may massage your cock.");
}
if(spanishexample == "i am a slut.") {
   show("Alright, alright.  You might be under the impression to uncapitalize 'I' when referring to youself, but you will not do that here.  This is a class about proper grammar, not proper slave grammar. Pinch your nipples. ");
}
if(spanishexample == "I am a slut") {
   show("You forgot to put a period at the end of your sentence, slut.  Slap your face, hard.");
}
if(spanishexample == "I am a slut, Mistress.") {
   show ("You even threw in a Mistress, good job!  I like my sluts to be respectful, haha.  Go ahead and tug yourself off for a bit.");
}

if((spanishexample != "I am a slut.")
   && (spanishexample != "i am a slut.")
   && (spanishexample != "I am a slut")
   && (spanishexample != "I am a slut, Mistress."))
{
   show("Well, you fucked up.  Face down, ass in the air.\n\n Now spank yourself 10 times for each character that is different from the phrase 'I am a slut.'  You wrote '"+spanishexample+"'");
}
showButton("Finished, Mistress")


edit2;
I just saw that you had already solved this problem and had encountered another (I missed that post). This is obviiously a possible solution to your first problem. I think this method is neater and easier to manage though. All correct answers have their own if block, and there's a single if block for wrong answers. It should be pretty simple how to add more wrong answers. I've separated them on to a new line each to make it even easier.


Top
 Profile Send private message 
 
 Re: Multiple IFs in an IF/ELSE statement.
PostPosted: Tue Jul 30, 2013 8:43 am 
Offline
Site Admin
User avatar
Could you replace sexscripts.jar in the main folder by this one, and try again ?


Attachments:
File comment: Beta release 1.14.3
sexscripts.jar [211.25 KiB]
Downloaded 761 times
Top
 Profile Send private message 
 
 Re: Multiple IFs in an IF/ELSE statement.
PostPosted: Wed Jul 31, 2013 5:24 am 
Offline
Regular
Nope, I'm still getting the same error.

Code:
Tue Jul 30 21:20:37 MDT 2013
os.name : Windows 7
os.arch : x86
java.version : 1.7.0_05
java.io.IOException: Premature EOF
   at sun.net.www.http.ChunkedInputStream.fastRead(Unknown Source)
   at sun.net.www.http.ChunkedInputStream.read(Unknown Source)
   at java.io.FilterInputStream.read(Unknown Source)
   at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(Unknown Source)
   at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
   at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
   at sun.nio.cs.StreamDecoder.read(Unknown Source)
   at java.io.InputStreamReader.read(Unknown Source)
   at java.io.BufferedReader.fill(Unknown Source)
   at java.io.BufferedReader.readLine(Unknown Source)
   at java.io.BufferedReader.readLine(Unknown Source)
   at ss.Publisher.doPublish(Publisher.java:429)
   at ss.Publisher.execute(Publisher.java:109)
   at ss.EditorFrame$8.actionPerformed(EditorFrame.java:235)
   at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
   at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
   at javax.swing.AbstractButton.doClick(Unknown Source)
   at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
   at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
   at java.awt.Component.processMouseEvent(Unknown Source)
   at javax.swing.JComponent.processMouseEvent(Unknown Source)
   at java.awt.Component.processEvent(Unknown Source)
   at java.awt.Container.processEvent(Unknown Source)
   at java.awt.Component.dispatchEventImpl(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Window.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
   at java.awt.EventQueue.access$000(Unknown Source)
   at java.awt.EventQueue$3.run(Unknown Source)
   at java.awt.EventQueue$3.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue$4.run(Unknown Source)
   at java.awt.EventQueue$4.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)


Top
 Profile Send private message 
 
 Re: Multiple IFs in an IF/ELSE statement.
PostPosted: Wed Jul 31, 2013 5:27 am 
Offline
Regular
Well, I deleted the contents of the error file, and that seemed to work. Maybe I didn't launch it properly after changing that .jar file.

Thanks!


EDIT: The script that successfully uploaded is an older version, where I used the wrong \ in the setImage commands. Would it be possible to remove it until we can figure out why the fixed version isn't working?

EDIT2: I commented out all the setImage commands, and it published without any problems. Maybe it's a file size issue?


Top
 Profile Send private message 
 
 Re: Multiple IFs in an IF/ELSE statement.
PostPosted: Wed Jul 31, 2013 8:51 am 
Offline
Site Admin
User avatar
It may be related to the size ; should I remove the second one ?


Top
 Profile Send private message 
 
 Re: Multiple IFs in an IF/ELSE statement.
PostPosted: Fri Aug 02, 2013 4:01 am 
Offline
Regular
Yeah, thank you! I'll reduce the size of the images, and reupload so it's got pictures.


Top
 Profile Send private message 
 
 Re: Multiple IFs in an IF/ELSE statement.
PostPosted: Fri Aug 02, 2013 7:26 pm 
Offline
Site Admin
User avatar
You shouldn't have to if they have a legitimate size (700px for example). But perhaps it's a special case ( a lot of picture, or something like that). Let me know if you need some help.

Well I'm late and you made an update with some picture, you still want me do delete it ?


Top
 Profile Send private message 
 
 Re: Multiple IFs in an IF/ELSE statement.
PostPosted: Sat Aug 03, 2013 11:20 am 
Offline
Regular
No, thanks. The one that's up right now is the one that I'm pretty sure works as intended.


Top
 Profile Send private message 
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Maroon Fusion theme created by Oxydo
Software, theme modifications, phpBB modification by Doti 2010 - 2020
This website uses session cookies only.