|SexScripts : Scripting main documentation - https://ss.deviatenow.com:443/viewtopic.php?f=4&t=2||Page 1 of 1|
Scripting main documentation
|doti [ Sat Apr 02, 2011 5:41 pm ]|
Scripts are in Groovy, a modern and quite easy computer language, maintained by the Apache Software Foundation.
A full documentation of it, and more information, on the official website. As a script writer, you do not need to read it.
Scripts must be in a file with a .groovy extension. There may be more than one file (one file can call another). This (or these) file(s) must be in the scripts/ folder of the SexScripts software (may be in a subfolder).
Pictures, videos and sounds should be in some subfolders of images/, videos/ and sounds/.
All will be compacted and sent to website if you use the publish function of the editor. All will be put in the good corresponding folders when standard downloading (desktop and Android versions).
How to begin ?
You should have read the user documentation, which include "How to create a script from..." (Picture gallery, Cybermistress, Milovana).
Then see messages below : How to start (I am a programmer), How to start (I am not a programmer).
The editor is bundled with the main software. But you may instead use ssScriptMaker, an extension to easily write scripts in a very few mouse clicks without any need of programming.
How to start (I am a programmer)
|doti [ Sat Apr 02, 2011 5:45 pm ]|
You know things about programming (VBA ? C++ ? Python ? ...) : good news, it isn't more difficult than that, SexScripts language is only Groovy (a simple language close to Java and Ruby), with some specific methods.
How to start (I am not a programmer)
|doti [ Sat Apr 02, 2011 5:58 pm ]|
Writing scripts is far from difficult. You have to write some orders to the tool (show something, set image ...: the "functions" listed below), and they will be executed one after one.
The syntax is midly strict, if you make some mistakes, they'll be showed to you to be corrected.
Main informations :
* A script is a text file (with some images, ... linked from it)
* Each order is on a line of that text file, line that may (no consequence) end with a ";"
* You can add spaces, tabs and line returns anywhere in the script
* Uppercase letters and lowercase letters are not the same
* A line beginning with "//" (two slashes) will be ignored, it's a comment.
Here is a quick start method for you
* Launch the SexScripts tool, then Menu>Script>Edit.
* Open simpleexample.groovy (Menu>File>Open).
* Read carefully
* Try to create a new script (Menu>File>New). There are some basic instructions in the file created, you just have to complete and save
* Test it (in the main window, Menu>script>Restart), correct it, expand it, test it, ...
* Come back here to ask any question (there are no stupid ones).
* There is a very good and complete manual/FAQ available in this thread.
|doti [ Sun Apr 03, 2011 2:22 pm ]|
See also tag reference
Functions are, with operators and various keywords, one of the things composing the language of SexScripts. It is the specific thing, the rest belonging to the base language, Groovy. Right-click in the editor to get some code snippets for them.
The most important functions are in red, beginners and intermediate script authors can ignore black functions.
Exits software (on the contrary, simply type returns null to exit script).
getBoolean(String message [, String yesText, String noText])
Asks user to click yes or no, return it (true or false). Set a yesText and a noText to avoid the standard texts ("Yes" and "No" in english). message will erase text (null to avoid this).
Examples : def b1 = getBoolean("Ok ?"); def b2 = getBoolean("Sure ?", "Yes", "Quite") ;
getBooleans(String message, String texts, String defaultValues)
Asks user to click some checkboxes, returns an array of boolean (true/false).
Returns a text string, the directory containing the images, sounds, videos folders, with the trailing slash. Use this instead of direct relative paths, when accessing some files in standard Java except of using this API functions.
Example : def dir = getDataFolder(); new File(dir+"/images/myscript/x.jpeg").renameTo(dir+"/images/myscript/y.jpg")// (and not simply new File("images/myscript/x.jpeg")...)
Asks user to choose a file, returns its full name, its full path included (or null if they cancelled).
getFloat(String message, Float defaultValue)
Asks user to write a number (perhaps with decimals). message will erase text (null to avoid this).
Use the webcam to take a picture. Returns its full name, its path included. If no webcam found, run getFile() instead.
getInteger(String message, Integer defaultValue)
Asks user to write a number, returns it. message will erase text (null to avoid this).
getSelectedValue(String message, String texts)
Asks user to select a value (string) among some. It will show a dropdown list, or some buttons, depending on space available and texts size. message will erase text (null to avoid this). Returns the number of this value (first one is 0).
getString(String message, String defaultValue)
Asks user to write something, returns it (or null if they cancelled). message will erase text (null to avoid this).
Example : def c = getString("What is your favorite color ?", "")
Returns an Integer, number of seconds since 01/01/1970
Returns a random number between 0 and max (excluded).
Example : if(getRandom(2) == 0) ...
Returns true if there is a connection to the internet and to the main SexScripts website.
Reads from data file a value associated with a key, returns it. The value may be of type boolean, integer, double, string, list of anything or map of anything. Returns null if not found.
Reads from the data file (data.properties) a boolean (true/false) associated with a key, returns it. Returns null if not found. Use this for example to know if user is a woman : def isWomen = loadBoolean("intro.women");. More info : see the file data.properties (open it with notepad, vi or any other text editor).
loadFirstTrue(String ... keys)
Reads from the data file some booleans, returning the first one that is true. Example : loadFirstTrue("a","b") will return "a" if there is "a=true" in data file, else "b" if there is "b=true", else null. Useful for toys and clothes options.
Reads from the data file a floating number associated with a key, returns it. Returns null if not found.
Reads from the data file a number associated with a key, returns it. Returns null if not found.
Reads from the data file a full map (String=>anything) of data associated with a key, returns it. Returns null if not found.
Reads in data file a character string associated with a key, returns it. Returns null if not found.
Example : show("Hello "+loadString("intro.name"))
Try to open all CD trays. If the device have no CD trays, but can vibrate, it will instead.
playBackgroundSound(String filename [, Integer times = 1])
Plays sound (.wav or .mp3 file must be in "sounds/" directory, or in a sub-directory). Does not wait for the end of the sound. Set filename to null to stop all sounds. The parameter "times" is optional, the sound will play "times" times (default value : 1).
Plays sound (.wav or .mp3 file must be in "sounds/" directory, or in a sub-directory). Waits for the end of the sound, then continues.
Reads from the online data file a value associated with a key, returns it. The value may be of type boolean, integer, double, String, list of anything or map of anything. Returns null if not found.
Reads from the online data file a boolean (true/false) associated with a key, returns it. Returns null if not found.
Reads from the online data file a floating number associated with a key, returns it. Returns null if not found.
Reads from the online server a picture associated with a code (from sendImage()), write it locally. Returns the full file path of the new local file. Returns null if not found.
Reads from the online data file an integer number associated with a key, returns it. Returns null if not found.
Reads from the online data file an character string associated with a key, returns it. Returns null if not found.
(this is a keyword, not a function) Stops the script and starts another one (or none il the name is null). The name is the name of a script, it must not end by ".groovy", but should start by the subdirectory, if any (with / to separate the directories, and taking care of the character case).
Example : return "clothes" //will stop the current script and start scripts/clothes.groovy
Example : return null
save(String key, * value)
Saves something (String, Integer, Float, Boolean, List, Map) in the datafile. Put null value to erase it (anyway, everything corresponding will be deleted before overwrited). The key must contains only letters, digits, dots, dashes (regexp : ^[\w\.\-]+$). See also load(), loadBoolean(), loadInteger(), etc.
send(String key, * value)
Sends something (String, Integer, Float, Boolean, List, Map) in the online datafile. Put null value to erase it (anyway, everything corresponding will be deleted before overwrited). The key must contains only letters, digits, dots, dashes (regexp : ^[\w\.\-]+$). See also receive(), receiveBoolean(), receiveInteger(), etc.
Sends an image file to the server (in a restricted location). Returns a character string, a code to load back the image file with receiveImage() later. Returns null if failed (not a picture, etc.). Big pictures are automatically scaled down.
Shows image (file must be in "images/" directory, perhaps in a sub-directory).
Extensions jpg, jpeg, png, gif are supported (even with transparency). If filename is null, it shows nothing.
(There is a cache system for pictures : if you update the file then show it again with setImage(), it may show the previous version.)
Example : setImage(null)
Example : setImage("myscript/picture4.jpeg")
setImage(byte bytes, int useless)
Shows image, being an array of bytes. The second parameter is useless now.
setImage(Image image, boolean useless)
Shows image, being a full java.awt.Image object. The second parameter is useless now. This method is deprecated since API 5.
setInfos(Integer version, String title, String summary, String author, String status, Integer color, String language, String tags)
Indicates some informations about this script. Put this one time at the start of the script. See template file (when creating a new script) for more informations.
Shows a simple message.
Example : show("About this : \n\nThat !")
showButton(String text[, Float seconds])
Shows a button with some text inside, after main text. Blocks script. Returns number of seconds waiting user's click.
May receive a second parameter, in seconds. If so, stops waiting after this duration and then hide the button and continue.
Example : showButton("Please quick click !", 3)
Shows a popup window with some text inside. Returns number of seconds waiting user click on [Ok].
Asks the system to start the tool associated with email sending (Outlook, mail, ...), with the receiver address as a parameter.
Asks the system to open the document (video, sound...), based on his name and extension (using "start" on Windows, "open" on Mac, "xdg-opn" on Linux). filename should be relative to the root directory of SexScripts, for example "video/myscript/sexy.avi".
Asks the system to open the URL ("https://....") in the default web browser.
Blocks script during some time.
Example : wait(0.5)
Blocks script during some time, showing a gauge.
This is the API 9. If someone starts a script that use the API 8 with an old release of SexScripts, a message will appear, asking to download a newer release.
You want more functions ? Something is missing ? Feel free to post in this forum.
Others functions (Java)
|doti [ Sat Aug 20, 2011 1:09 pm ]|
Most Java/Groovy functions are available for script writers. Beware :
Here are some functions quite easy to use and useful :
Return a number, one part of the current Date. Parameter is a constant, prefixed by "Calendar", there are YEAR, MONTH, (0..1) DAY_OF_MONTH (1..31), DAY_OF_WEEK (1..7), HOURS_OF_DAY (0..23), MINUTE, SECOND.
Example : def y = Calendar.getInstance().get(Calendar.YEAR)
Returns a number rounded to the nearest integer below.
Example : def x = 0.8, y = Math.floor(x)
Returns a number rounded to the nearest integer.
Example : def x = 0.8, y = Math.round(x)
Returns the square root of a number.
Example : def x = Math.sqrt(16)
String.format(String format, * value1, * value2...)
Returns a text string, formatting numbers. The format is a text string, with some special expression indicating formatted values. Each of this expression follows this form : %[options][type]. Type may be "d" (decimal), "f" (floating number), "s" (string)... And each type has some options, for example "f" may have the number of digits after a dot.
Example : def x = 1.23, s = String.format("%d", x) // s contains "1"
Example : def x = 1.23, s = String.format("%d - %f - %.1f - %.3f", x, x, x, x) // s contains "3 - 1.23 - 1.2 - 1.230"
About your identity (ies)
|doti [ Sun May 20, 2012 11:49 am ]|
You may be identified 2 times : with an account in this forum (used only in the website forum), and in scripts ("author" in script, shown in the Scripts web page). Anonymous in the forum may read but not write. "Anonymous" as an author name in scripts is quite allowed.
One relation between those two identifications : if the same, when publishing, there will be a link on your username to your forum identity in the Scripts page.
Using the scripts is anonymous, except stated otherwise ("internet" tag). The SexScripts software itself do not automatically "phone home" - it'll connect only, anonymously, when opening the about box (to get the version), downloading a script and using some "internet" scripts. IP address is then temporary stored on the SexScripts server to mitigate some possible hacking attempts.
GDPR informations for european users : we don't know your personal informations ; we don't want to know your personal informations ; you must avoid to give anything about your personal informations here (names, age, location, ...). Using SexScripts, you send your data to those third parties : Alphabet by Google Analytics on the web site (website traffic), and Fyber by Heyzap on the Android application (advertising).
|doti [ Sun Mar 15, 2015 11:13 pm ]|
Those functions use the communication API (from API 6 upward) : isConnected(), receive(), receiveBoolean(), receiveFloat(), receiveImage(), receiveInteger(), receiveString(), send(), sendImage().
Communications are encrypted if possible ; they use HTTPS over TCP, from the client (the main software) to the server (https://ss.deviatenow.com), or degrade to HTTP if needed (Java 6 for example).
There are limits encoded in the client software and on the server. The most noticeable are a soft limit on the number of calls per day (and also per session). When those limits are reached, some pesky additionnal delays are added (more and more). Mainly : maximum 50 calls (in total, using any of the function above) for one script.
Another limit is the size of data for the send() function : 1 kilobyte for the key, 10 kilobytes for the value (or values).
As a consequence, for now, the API is not suitable for synchronous communication (a chat application or things like that) or massive communication (image gallery, etc.).
As a user, you should not try to overstep those limits (by modifying the client software for example). It will fail, and you'll be banned.
As a developer :
If you have any question, please feel free to ask on the forum.
|Page 1 of 1||All times are UTC + 1 hour [ DST ]|