| SexScripts : Multiple IFs in an IF/ELSE statement. - https://ss.deviatenow.com:443/viewtopic.php?f=4&t=323 | Page 1 of 1 |
Multiple IFs in an IF/ELSE statement. |
Allie [ Thu Jul 25, 2013 5:53 am ] |
|---|---|
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? |
|
Re: Multiple IFs in an IF/ELSE statement. |
doti [ Thu Jul 25, 2013 6:31 pm ] |
|---|---|
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") |
|
Re: Multiple IFs in an IF/ELSE statement. |
Allie [ Fri Jul 26, 2013 3:49 am ] |
|---|---|
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 |
|
Re: Multiple IFs in an IF/ELSE statement. |
doti [ Fri Jul 26, 2013 8:45 pm ] |
|---|---|
Can you write here the 30 or 40 last lines of the file "errors.log" ? |
|
Re: Multiple IFs in an IF/ELSE statement. |
Allie [ Sat Jul 27, 2013 11:42 pm ] |
|---|---|
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) |
|
Re: Multiple IFs in an IF/ELSE statement. |
asdf1234 [ Sun Jul 28, 2013 8:15 am ] |
|---|---|
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. |
|
Re: Multiple IFs in an IF/ELSE statement. |
doti [ Tue Jul 30, 2013 8:43 am ] | ||
|---|---|---|---|
Could you replace sexscripts.jar in the main folder by this one, and try again ?
|
|||
Re: Multiple IFs in an IF/ELSE statement. |
Allie [ Wed Jul 31, 2013 5:24 am ] |
|---|---|
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) |
|
Re: Multiple IFs in an IF/ELSE statement. |
Allie [ Wed Jul 31, 2013 5:27 am ] |
|---|---|
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? |
|
Re: Multiple IFs in an IF/ELSE statement. |
doti [ Wed Jul 31, 2013 8:51 am ] |
|---|---|
It may be related to the size ; should I remove the second one ? |
|
Re: Multiple IFs in an IF/ELSE statement. |
Allie [ Fri Aug 02, 2013 4:01 am ] |
|---|---|
Yeah, thank you! I'll reduce the size of the images, and reupload so it's got pictures. |
|
Re: Multiple IFs in an IF/ELSE statement. |
doti [ Fri Aug 02, 2013 7:26 pm ] |
|---|---|
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 ? |
|
Re: Multiple IFs in an IF/ELSE statement. |
Allie [ Sat Aug 03, 2013 11:20 am ] |
|---|---|
No, thanks. The one that's up right now is the one that I'm pretty sure works as intended. |
|
| Page 1 of 1 | All times are UTC + 1 hour [ DST ] |