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


Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Re: Scripting main documentation
PostPosted: Mon Jun 27, 2011 7:45 pm 
Offline
Newcomer
Hi - just a couple quick questions:

Is there a function that allows videos to be played, similar to the getimage function?

Is there a way to provide a button, but with a hidden timer that will remove the button if it isn't pressed in time?

Thanks for your help!


Top
 Profile Send private message 
 
 Re: Scripting main documentation
PostPosted: Mon Jun 27, 2011 7:51 pm 
Offline
Site Admin
User avatar
No, for now, nothing about video. This could be done. What format do you suggest ? (.avi / .mp4 with h264 ?)

Button + timer : yes, showButton with a second parameter (time to wait in seconds)
Code:
showButton("Click here quick !", 2)


I moved this to a new topic (and locked the other, I forgot to do it before).


Top
 Profile Send private message 
 
 Re: Scripting main documentation
PostPosted: Tue Jun 28, 2011 8:03 am 
Offline
Veteran
User avatar
Ideally, for any video playback, I'd like to see support for:
.avi
.wmv
.mp4
.flv
(in that order of priority)


Top
 Profile Send private message 
 
 Re: Scripting main documentation
PostPosted: Tue Jun 28, 2011 8:28 am 
Offline
Newcomer
Thanks!

Apologies for posting in the wrong section.


Top
 Profile Send private message 
 
 Re: Scripting main documentation
PostPosted: Wed Jul 20, 2011 7:28 pm 
Offline
Veteran
User avatar
Having fun playing with the new version! :)

A couple of questions, though:

1) Is it possible to make a sound 'loop' over and over (until a button is clicked or a 'wait' runs out, for example?)

2) As asked by someone else above, I want to be able to have a part in my script where you are given a time limit to click a button. If you click the button, the script continues in one 'path', if you fail to click it in time (10 seconds), the script continues with a different path. How would I go about scripting this, using:

showButton("Click here quick !", 10)

To decide if it registers the click or not, what do I do? Sorry, still trying to get the hang of the language and how it all works!

Also, is it possible to do the above with a 'gauge' on screen too?


Top
 Profile Send private message 
 
 Re: Scripting main documentation
PostPosted: Wed Jul 20, 2011 7:48 pm 
Offline
Site Admin
User avatar
1 - here is an example :
Code:
def ended = false
while(ended == false) {
  playBackgroundSound("a.wav")
  if(showButton("Click now", 10) < 10)
    ended = true
}


2 - quite the same thing :
Code:
if(showButton("Click here quick !", 10) < 10)
  show("You clicked !")


No, for now, there's no solution with a gauge. I'm not sure about it (adding this may induce some problems. Things in the same time usually invole a lot of problems).


Top
 Profile Send private message 
 
 Re: Scripting main documentation
PostPosted: Thu Jul 21, 2011 6:12 pm 
Offline
Veteran
User avatar
I couldn't get the first example to work to make a sound repeat/loop in a single "block" (sorry, still thinking in CyberMistress terms!). Is there not an easier way, as this seems like a function a lot of people would want to use a lot (example: for a 'metronome' beat (tom.wav) for stroking, etc.)

Also... how do you do a "random" choice from a button? Example: I want to make it so you can click one of two buttons:

If you click Yes, if randomly (getRandom) results in one of three lines of dialog.
If you click No, it randomly selects from a different three lines of dialog.

How do I set this up? I was assuming something like:

Code:
if(getBoolean("Red or blue?","Red","Blue"))
   if(getRandom(3)==0)
      show("Red Text 1")
   else
   if(getRandom(3)==1)
      show("Red Text 2")
   else
   if(getRandom(3)==2)
      show("Red Text 3")
else
   if(getRandom(3)==0)
      show("Blue Text 1")
   else
   if(getRandom(3)==1)
      show("Blue Text 2")
   else
   if(getRandom(3)==2)
      show("Blue Text 3")


But it doesn't work (clicking 'Red' seems okay, but clicking 'Blue' just loops the button and doesn't do anything. What am I missing? I'm presuming it's something obvious with the indenting of an 'else' somewhere or missing brackets? :(

Oh, and that's fine about the gauge... don't really need it here, just something I wondered.

It's taking me a lot of work to learn the code, but SexScripts is coming along great as a program! :)


Last edited by Banjo on Sun Jul 24, 2011 6:24 am, edited 2 times in total.

Top
 Profile Send private message 
 
 Re: Scripting main documentation
PostPosted: Fri Jul 22, 2011 11:23 am 
Offline
Site Admin
User avatar
Your code is nearly working, but getRandom() find a new number each time. So prefer this :
Code:
def randomNumber = getRandom(3)
if(getBoolean("Red or blue?","Red","Blue"))
   if(randomNumber==0)
      show("Red Text 1")
   else
   if(randomNumber==1)
      show("Red Text 2")
   else
      show("Red Text 3")
else
   if(randomNumber==0)
      show("Blue Text 1")
   else
   if(randomNumber==1)
      show("Blue Text 2")
   else
      show("Blue Text 3")


Top
 Profile Send private message 
 
 Re: Scripting main documentation
PostPosted: Sat Jul 23, 2011 8:21 am 
Offline
Veteran
User avatar
Thanks, that works great!

For the looping sounds, I got your previous example to work, but how about if I want to do it with a "wait" rather than a button?

That is, loop a sound every 2 seconds for 30 seconds, then stop the sound?


Top
 Profile Send private message 
 
 Re: Scripting main documentation
PostPosted: Sat Jul 23, 2011 3:12 pm 
Offline
Site Admin
User avatar
This is simpler, there is an example at the end of test.groovy.
Shortest solution :
Code:
for(def i=0;i<15;i++) {
  playBackgroundSound("a.wav")
  wait(2)
}


There were an error in my example above ?

edit: there were some sound synchronisation problems that are gone with the maintenance release now available (v0.95).


Top
 Profile Send private message 
 
 Re: Scripting main documentation
PostPosted: Sat Jul 23, 2011 8:17 pm 
Offline
Veteran
User avatar
No, just an error with my understanding of it! :)

That "loop+wait" example code works great, too... just what I wanted!

Out of curiosity, would it be possible to make the wait time random, using getRandom in some way in the above example code instead of the 'fixed' delay/wait time (15 seconds in the example)?


Top
 Profile Send private message 
 
 Re: Scripting main documentation
PostPosted: Sat Jul 23, 2011 9:05 pm 
Offline
Site Admin
User avatar
Of course, here 10 to 20 times with 1 to 3 seconds between each :
Code:
for(def i=0;i<10+getRandom(11);i++) {
  playBackgroundSound("a.wav")
  wait(1+getRandom(5)/2)
}

Or, same conditions, but always the same time
Code:
def delay = 1+getRandom(5)/2
for(def i=0;i<10+getRandom(11);i++) {
  playBackgroundSound("a.wav")
  wait(delay)
}


Top
 Profile Send private message 
 
 Re: Scripting main documentation
PostPosted: Sun Jul 24, 2011 5:45 am 
Offline
Veteran
User avatar
Awesome, I thought so! Thanks!

How about displaying a random picture? Say I have ten images named "image01.jpg" to "image10.jpg" and want to use setImage to display one of these at random... what's the simplest way to do so? Is there a way to use "wildcards" like we could in CM:
Code:
setImage(image*.jpg)

If not, what's the way to do it with the least amount of code, since this could be used over and over for every image in a script sometimes! One "def" at the start, then setting this to random each time, maybe?

Also, what about if I wanted to incrementally increase or decrease a boolean/integer in order to play a sound multiple times?

The previous "loop" works fine when you know the length of the sound being played (just put that as the "wait" time in between loops) but I was wondering if it was also possible to - say - decrease an integer every time a sound plays, until it reaches zero, and the looping stops (and the script continues)? Hope that makes some sort of sense!

Basically, I guess I'm asking... how do very basic math functions work in Groovy? :oops:

(as an aside, I'm assuming you can use "<" and ">" in place of "=" when checking against getRandom results, as in your random example previously?)

Sorry for all the questions, Doti!


Top
 Profile Send private message 
 
 Re: Scripting main documentation
PostPosted: Sun Jul 24, 2011 10:24 am 
Offline
Site Admin
User avatar
You must know the number of images. Example with 1 to 12 :
Code:
setImage("image"+(1+getRandom(12))+".jpg")


Quote:
The previous "loop" works fine when you know the length of the sound being played (just put that as the "wait" time in between loops) but I was wondering if it was also possible to - say - decrease an integer every time a sound plays, until it reaches zero, and the looping stops (and the script continues)? Hope that makes some sort of sense!

I did not understood - but you have to know the duration of the sounds you use.

Yes, maths are all here, like in that :
Code:
def a = 5 * (3 + 8) / 2
if( (a>2 and a<6) or (a==7) ) show("ok")


Top
 Profile Send private message 
 
 Re: Scripting main documentation
PostPosted: Sun Jul 24, 2011 12:44 pm 
Offline
Veteran
User avatar
doti wrote:
You must know the number of images. Example with 1 to 12 :
Code:
setImage("image"+(1+getRandom(12))+".jpg")


Quote:
The previous "loop" works fine when you know the length of the sound being played (just put that as the "wait" time in between loops) but I was wondering if it was also possible to - say - decrease an integer every time a sound plays, until it reaches zero, and the looping stops (and the script continues)? Hope that makes some sort of sense!

I did not understood - but you have to know the duration of the sounds you use.

Yes, maths are all here, like in that :
Code:
def a = 5 * (3 + 8) / 2
if( (a>2 and a<6) or (a==7) ) show("ok")


First one (for images) is exactly what I wanted to know, thanks.

Knowing the math functions pretty much resolves the second example I needed, too. I do need to know, though, exactly how to change a value numerically. How would I add 1 to an already-defined and existing integer/boolean (as I understand, integers should be used for pure numbers, right?)?

For example, I have "def a=5" in my script. Later on, I want to add two to "a" to make it 7. How do I code this?


Top
 Profile Send private message 
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 3 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.