[Tease AI Java] TAJUtils Guide and Documentation

Webteases are great, but what if you're in the mood for a slightly more immersive experience? Chat about Tease AI and other offline tease software.

Moderator: 1885

Post Reply
ski23
Explorer At Heart
Explorer At Heart
Posts: 464
Joined: Sun Jun 11, 2017 12:53 am
Gender: Male
Sexual Orientation: Bisexual/Bi-Curious
I am a: Switch
Dom/me(s): Courtney
Sub/Slave(s): Courtney
Location: Virginia
Contact:

[Tease AI Java] TAJUtils Guide and Documentation

Post by ski23 »

About Me
I am ski23, creator of the Tease AI Java personality Mischevious and contributor to Tease AI Java itself. I am a senior in Computer Science at Virginia Tech, and I have real world programming job experience. Any question you have about TAJUtils, I should be able to answer.

Introduction
TAJUtils are a series of 4 utils files that I wrote that will allow developers to quickly and easily create personalities and modules by reducing the amount of coding developers need to do themselves.
The 4 utils files in TAJUtils are:
  • ChatUtils
  • MediaUtils
  • StrokingMethodUtils
  • PersonalityUtils
You can use as many or as few of these utils files individually. Although, it does generally help to always have ChatUtils for messages. You can find the TAJ General Developer Guide here.

Download
You will always be able to find these utils files in the main folder for Mischevious. However, you can find them individually here (right click the page and select "save as"):
ChatUtils
MediaUtils
StrokingMethodUtils
PersonalityUtils

Overview
Here I will go into an overview about what each of these utils files do:
ChatUtils:
ChatUtils is a Utility that allows for very customizable messages.
ChatUtils allows you to:
  • send system messages with no sender or a specified sender
  • easily send custom messages with whatever font, color, font size, bold, italics you wish
  • send debug messages that can be seen in chat if the debug configuration is on. This is very helpful for debugging an issue.
  • Throw error and warning messages
  • Disabling responses from triggering inside of a response to getInput
MediaUtils:
MediaUtils provides a way to sort display and like/dislike media (currently only images)
MediaUtils allows you to sort your pictures into 4 types: Dislike, Normal, Like, Love. Disliked pictures are discarded. Pictures can be sorted into these folders and then later, you can display a picture from one of these folders.
You may be wondering the use for this. One good example is if the domme wants to build you up slow and starts by showing you images that you think are normal or ok, but then starts showing images that you have marked as liked and eventually images that you absolutely love. Within each of these folders, every image can also have tags associated to it. This part I built directly into TAJ itself though so you don't need this util file for tagging of pictures alone.

StrokingMethodUtils:
StrokingMethodUtils is a utility that provides the functionality for different methods of stroking other than just "stroking." If you choose to not include this file, Mischevious or any other personality that has PersonalityUtils will work as it did in the original TeaseAI with stroking cycles. However, StrokingMethodUtils will allow more diversity.
This utility will work as is. However, it is still a work in progress and there are many more features I will be adding to this utility.

PersonalityUtils:
PersonalityUtils is the largest of all of the Utilities in TAJUtils. This utility provides all of the functionality needed for a personality such as:
  • A built in stroking and edging system with taunts that uses complex formulas to make sessions diverse
  • A complex mood system that uses the domme's mood and apathy level to determine stroking/edging length and speed, orgasm chance, and (in the case of Mischevious) many other domme decisions
I would recommend using PersonalitUtils for any new personalities because this will make creating a new personality way easier without having to reinvent the wheel.

Important Details
When calling these utility files for the first time with run(), make sure to use the utility's corresponding setup method as well ex:

Code: Select all

run(chatutils.js);
setUpChat();
Part 1: ChatUtils
Here I will show how to use the utility methods in ChatUtils method by method.
(def) stands for a default parameter. These parameters do not need to be passed for the utility method to work.
Method Name: DMessage
Description: Sends a debug message that will appear if debug mode is enabled. Useful for debugging and finding errors.
Parameters: message: the debug message, (def)delay: the amount of time in seconds to wait after the message
Example(s):

Code: Select all

DMessage("Module start", 1); 
Dmessage("Module End");
Method Name: CMessage
Description: Sends a custom message from the domme.
Parameters: message: the custom message, (def)delay: the amount of time in seconds to wait after the message, showTyping:whether or not the typing alert will appear
Example(s):

Code: Select all

CMessage("Hello %subname%"); 
CMessage("<c=lightgreen b fs=16>Hello sub"); -> sends a light green, bolded message with font size 16
Extra info: To do custom messages with colors fonts and etc, use this formatting:

Code: Select all

<x1 x2 x3>
and finally use

Code: Select all

<>
to end that set of formatting. For example:

Code: Select all

<c=lightgreen b fs=16>Hello<> sub
would print Hello in light green bolded with a font size of 16. However, sub would be in the default text again. Here is a list of available formatters:
  • Strikethrough: s
  • Underline: u
  • Italic: i
  • Bold: b
  • Font Size: fs = (font size)
  • Font: f = (font name)
  • Color: c = (color name)
This formatting system can also be used with the other messaging methods as well.

Method Name: SMessage
Description: Sends a system message that will appear with no author or the specified author. Useful for sending system messages such as "%domname% has connected" or "%domname% is afk" or for sending messages as a glitter contact.
Parameters: message: the message, (def)delay: the amount of time in seconds to wait after the message, (def) sender: the person who will send the message 1= domme 2 = contact 1, 3 = contact 2, 4 = contact 3
Example(s):

Code: Select all

SMessage("%domname% is now afk", 1); 
Smessage("Nice to meet you %subname%", 0 , 2); -> will be sent from contact 1
Method Name: WMessage
Description: Sends a waning message that will appear in the logs but won't appear in the chat unless debug is enabled.
Parameters: message: the message, (def)delay: the amount of time in seconds to wait after the message
Example(s):

Code: Select all

WMessage("This picture folder is empty. Trying another folder");
Method Name: EMessage
Description: Sends an error message that will show up in chat even if debug is disabled. Use this for fatal errors that will crash the personality.
Parameters: message: the message, (def)delay: the amount of time in seconds to wait after the message
Example(s):

Code: Select all

EMessage("Cannot find module to run. Aborting!");
Method Name: getInput
Description: Works exactly the same as sendInput except, you can use custom messages with this method, and it sets the personality variable responsesDisabled to true. You can then use this in responses that you don't want to get triggered during an answer to question.
Parameters: message: the message, (def)delay: the amount of time in seconds to wait after the message
Example(s):

Code: Select all

var answer = getInput("<c=green>Do you like lemons?"); -> if there was a response that triggered on the word "yes",
 and that response checked for the responsesDisabled flag,
 then that response would not be triggered here if the user responded with "yes".
Last edited by ski23 on Thu Sep 06, 2018 6:31 pm, edited 1 time in total.
ski23
Explorer At Heart
Explorer At Heart
Posts: 464
Joined: Sun Jun 11, 2017 12:53 am
Gender: Male
Sexual Orientation: Bisexual/Bi-Curious
I am a: Switch
Dom/me(s): Courtney
Sub/Slave(s): Courtney
Location: Virginia
Contact:

Re: [Tease AI Java] TAJUtils Guide and Documentation

Post by ski23 »

Part 2: MediaUtils
Here I will show how to use the utility methods in MediaUtils method by method.
(def) stands for a default parameter. These parameters do not need to be passed for the utility method to work.
Method Name: showTaggedImage
Description: Randomly selects an image from the specified imageType folder that has all of the tags specified. Returns the displayed image.
Parameters: imageType: the folder type the image is located in. Valid options:
  • Normal, 2
  • Liked, 3
  • Loved, 4
,imageTags: an array of image tags; All valid image tags can be viewed in the built-in image tagger, (def) delay:the amount of time in seconds to wait after displaying the image before continuing on
Example(s):

Code: Select all

showTaggedImage(3, ["naked", "lesbian"]); -> will show a liked image with the tags naked and lesbian
Method Name: getImagePath
Description: Gets the path of the current displayed image
Parameters:
Example(s):

Code: Select all

var path = getImagePath();
Method Name: sortPicture
Description: Moves a picture from one sort folder to another. For example, from the liked folder to the loved folder.
Parameters: file: the file to move(either an instance of the java file, a taggedpicture, a full file path, or a path relative to TAJ), (def)sortPlace: the destination with the valid options shown in the above method.
Example(s):

Code: Select all

sortPicture(getImagePath(),3); -> moves the currently displayed image to the liked folder
Method Name: getTeasePicture
Description: Randomly selects and displays an image from the specified folder. Returns the displayed image.
Parameters: file: (def) flag: The folder to pick from. This method can use 1 here to specify the tumblr folder, (def) delay: the amount of time in seconds to wait after displaying the image before continuing on.
Example(s):

Code: Select all

getTeasePicture();
Part 3: StrokingMethodUtils
This utility does not have any methods that you will need to call yourself. Instead, for this utility, I will describe how to add your own stroking methods. If you look at the stroking methods included by default, you will see something like this:

Code: Select all

function NormalStrokingMethod() {
    StrokingMethod.call(this, "Start stroking with one hand with no lube", 4, 0, 1, 3, false);
}
NormalStrokingMethod.prototype = Object.create(StrokingMethod.prototype);
NormalStrokingMethod.prototype.constructor = NormalStrokingMethod;
To create your own stroking method, simply copy this, replace the obvious variable names with your own, change the text and parameters in the constructor call, and add your new stroking method to the array in the getAllMethods method. These parameters correspond to
  • the text the domme will read
  • intensity
  • tease- How teasing this method is (foreplay methods have high tease values)
  • torture- How torturous the method is
  • closeness- How quickly the method gets the sub to the edge
  • uselube- Whether or not this method uses lube
Part 4: PersonalityUtils
Here I will show how to use the utility methods in PersonalityUtils method by method.
(def) stands for a default parameter. These parameters do not need to be passed for the utility method to work.
Method Name: Stroking
Description: Main stroking method most modules will want to use. This stroking method will make the sub stroke for a certain amount of time, and speed determined based on mood and apathy. This method includes the start stroking method so, no need to send this message yourself. Use this to replicate (stroking cycles) from the original Tease AI.
Parameters:
Example(s):

Code: Select all

Stroking();
Method Name: customStroking
Description: Works exactly the same as the above method. However, this method allows the option to pass in the message that will be sent instead of the default.
Parameters: message: the message to send to start stroking
Example(s):

Code: Select all

customStroking("It's time to start stroking %subname%");
Method Name: isStroking
Description: Returns true if the sub is stroking. Note: this will not return true if the sub is edging.
Parameters:
Example(s):

Code: Select all

isStroking();
Method Name: speedUpStroking
Description: Will increase the speed of stroking
Parameters: amount: a number 1-5. 1 will increase the speed only slightly. 5 Will increase the speed significantly.
Example(s):

Code: Select all

speedUpStroking(3);
Method Name: setStroking
Description: Can start stroking and manually set the duration and bpm. This can be used for developers who don't want to use TAJUtils' built in mood and apathy system for stroking.
Parameters: duration: duration to stroke in seconds, bpm: beats per minute to stroke at
Example(s):

Code: Select all

setStroking(20, 80);
Method Name: customSetStroking
Description: Works the same as the method above. Except, allows for a custom message to be sent.
Parameters: duration: duration to stroke in seconds, bpm: beats per minute to stroke at, message: the message that will be sent
Example(s):

Code: Select all

setStroking(20, 80, "start stroking now %subname%");
Method Name: getStrokingPercent
Description: Gets the percent how far the sub is through the current stroking cycle.
Parameters:
Example(s):

Code: Select all

getStrokingPercent();
Method Name: DoEdges
Description: Makes the sub do some amount of edges and possibly holds. This is extremely useful in modules to make modules be able to be harder or easier based on the domme mood and apathy. I recommend using exclusively this method for edging in modules unless something more specific is needed.
Parameters:minEdges: the lowest amount of edges possible, maxEdges: the highest amount of edgesPossible, holdChancePerEdge: the chance for each edge that the domme will make the sub hold the edge.
Example(s):

Code: Select all

DoEdges(1, 5, 15); -> will do between 1 and 5 edges with 15% chance to hold the edge for each edge
Method Name: startEdging
Description: Makes the sub do one edge with the specified message
Parameters: message: the message to send to start edging
Example(s):

Code: Select all

startEdging("start edging for me %subname%");
Method Name: startEdgingBPM
Description: Works exactly the same as the above method except, you can specify the speed yourself.
Parameters: bpm: the beats per minute to edge at, message: the message to send to start edging
Example(s):

Code: Select all

startEdgingBPM(80, "start edging for me %subname%");
Method Name: isEdging
Description: Returns true if the sub is edging
Parameters:
Example(s):

Code: Select all

isEdging();
Method Name: holdEdge
Description: Will make the sub hold an edge after they have just gotten to the edge. This uses apathy and mood to determine how long to make the sub hold the edge.
Parameters:
Example(s):

Code: Select all

holdEdge();
Method Name: startHoldEdge
Description: Will make the sub start holding an edge. This will never end unless you call stopEdging.
Parameters:
Example(s):

Code: Select all

startHoldEdge();
Method Name: calculateOrgasm
Description: Calculates if the sub will orgasm based on apathy, mood, and the sub's configuration for orgasm chance.
Parameters:
Example(s):

Code: Select all

if (calculateOrgasm()){
do something
}
Method Name: calculateRuin
Description: Calculates if the sub will ruin their orgasm based on apathy, mood, and the sub's configuration for ruin chance. This needs to be called only if calculateOrgasm returned true.
Parameters:
Example(s):

Code: Select all

if (calculateOrgasm()){
	if (calculateRuin()){
		do something
	}
}
Method Name: increaseAnger
Description: Will make the domme angrier. A negative value will make the domme happier.
Parameters: amount: the amount to make the domme angrier or happier. Valid options: -5 through 5 not including 0
Example(s):

Code: Select all

increaseAnger(3); -> makes the domme moderately more angry
increaseAnger(-5); -> makes the domme much more happy
Method Name: getApathyMoodIndex
Description: An extremely useful method that gets a value called the ApathyMoodIndex. This value is a combination of the mood and apathy and results in a number out of 100. 100 means the domme is very pissed. 0 means the domme is extremely happy. This can be used in modules to change what happens or how harsh something happens based on the domme's mood and apthy.
Parameters:
Example(s):

Code: Select all

var apm = getApathyMoodIndex();
Method Name: getMood
Description: Gets the domme's mood state. This is a value between 0 and 100 such that 100 means the domme is very angry and 0 means the domme is very happy. This can be useful for changing how harsh the domme speaks. However, for decisions on how harsh something should happen or what scenario should occur, use the apathyMoodIndex instead.
Parameters:
Example(s):

Code: Select all

var mood = getMood();
Method Name: getApathyLevel
Description: Gets the domme's apathy level. Most of the time you will probably want to use the ApathyMoodIndex instead.
Parameters:
Example(s):

Code: Select all

var apathy = getApathyLevel();
Conclusion
I wrote these utilities with the hope that they will be useful to others as well as myself in creating modules and personalities easily. These utilities will grow and change over time, and I will try to keep these documents updated to reflect that. If anyone has any questions, feel free to ask me any questions related to these utilities in this thread, and I will answer them as soon as I can
ski23
Explorer At Heart
Explorer At Heart
Posts: 464
Joined: Sun Jun 11, 2017 12:53 am
Gender: Male
Sexual Orientation: Bisexual/Bi-Curious
I am a: Switch
Dom/me(s): Courtney
Sub/Slave(s): Courtney
Location: Virginia
Contact:

Re: [Tease AI Java] TAJUtils Guide and Documentation

Post by ski23 »

reserved for further expansion
ski23
Explorer At Heart
Explorer At Heart
Posts: 464
Joined: Sun Jun 11, 2017 12:53 am
Gender: Male
Sexual Orientation: Bisexual/Bi-Curious
I am a: Switch
Dom/me(s): Courtney
Sub/Slave(s): Courtney
Location: Virginia
Contact:

Re: [Tease AI Java] TAJUtils Guide and Documentation

Post by ski23 »

reserved for further expansion
User avatar
genome231
Explorer At Heart
Explorer At Heart
Posts: 683
Joined: Wed Nov 12, 2014 8:35 am

Re: [Tease AI Java] TAJUtils Guide and Documentation

Post by genome231 »

Nice

Currently going through your work.
Definetly helps me understand more of TAIJ.

Thanks for taking the time to explain so much in detail!

Genome
Tribute to 1885 & those involved with Tease-AI.
Thank you for spending time on this awesome project! :-)
ski23
Explorer At Heart
Explorer At Heart
Posts: 464
Joined: Sun Jun 11, 2017 12:53 am
Gender: Male
Sexual Orientation: Bisexual/Bi-Curious
I am a: Switch
Dom/me(s): Courtney
Sub/Slave(s): Courtney
Location: Virginia
Contact:

Re: [Tease AI Java] TAJUtils Guide and Documentation

Post by ski23 »

genome231 wrote: Fri Aug 31, 2018 2:54 pm Nice

Currently going through your work.
Definetly helps me understand more of TAIJ.

Thanks for taking the time to explain so much in detail!

Genome
Im glad you’re finding it helpful!
User avatar
genome231
Explorer At Heart
Explorer At Heart
Posts: 683
Joined: Wed Nov 12, 2014 8:35 am

Re: [Tease AI Java] TAJUtils Guide and Documentation

Post by genome231 »

A question! And a big one xD

Code: Select all

function sortPicture(file, sortPlace=2)
{
    var taggedPicture = Java.type("me.goddragon.teaseai.api.picture.TaggedPicture");
    DMessage("Moving file" + file, 0);
    var myFile;
    var taggedFile;
    if (file instanceof java.io.File) {
        myFile = file;
        taggedFile = new taggedPicture(myFile);
    }
    else if (file.search(teasePath) != -1) {
        myFile = new java.io.File(file);
        taggedFile = new taggedPicture(myFile);
    }
    else if (file instanceof taggedPicture)
    {
        taggedFile = file;
    }
    else {
        myFile = new java.io.File(teasePath + separator + file);
        taggedFile = new taggedPicture(myFile);
    }
    var localpath = "";
    switch (sortPlace) {
        case 1:
        case "dislike":
            localpath = "delete";
            break;
        case 2:
        case "normal":
            localpath = "images" + separator + "normal" + separator;
            break;
        case 3:
        case "liked":
            localpath = "images" + separator + "liked" + separator;
            break;
        case 4:
        case "loved":
            localpath = "images" + separator + "loved" + separator;
            break;
        default:
            localpath = null;
    }
    if (localpath == null)
    {
        EMessage("sortPicture called with invalid args!");
    }
    else if (localpath == "delete")
    {
        myFile.delete();
        return true;
    }
    else
    {
        return taggedFile.move(getAppPath() + localpath + myFile.getName());
    }
    return false;
}
I really like the ability to move/sort files, but this function sort of goes above my level of coding :P
So I'm gonna copy it, but I wanna make a few modifications to it, but first I need something explained.
I understand the switch, and the second if statement, but the first if statement at the top of the code before the swithc, can you explain to me what is happening in more detail?

Best regards
Genome
Tribute to 1885 & those involved with Tease-AI.
Thank you for spending time on this awesome project! :-)
ski23
Explorer At Heart
Explorer At Heart
Posts: 464
Joined: Sun Jun 11, 2017 12:53 am
Gender: Male
Sexual Orientation: Bisexual/Bi-Curious
I am a: Switch
Dom/me(s): Courtney
Sub/Slave(s): Courtney
Location: Virginia
Contact:

Re: [Tease AI Java] TAJUtils Guide and Documentation

Post by ski23 »

genome231 wrote: Sun Sep 02, 2018 9:40 am A question! And a big one xD

Code: Select all

function sortPicture(file, sortPlace=2)
{
    var taggedPicture = Java.type("me.goddragon.teaseai.api.picture.TaggedPicture");
    DMessage("Moving file" + file, 0);
    var myFile;
    var taggedFile;
    if (file instanceof java.io.File) {
        myFile = file;
        taggedFile = new taggedPicture(myFile);
    }
    else if (file.search(teasePath) != -1) {
        myFile = new java.io.File(file);
        taggedFile = new taggedPicture(myFile);
    }
    else if (file instanceof taggedPicture)
    {
        taggedFile = file;
    }
    else {
        myFile = new java.io.File(teasePath + separator + file);
        taggedFile = new taggedPicture(myFile);
    }
    var localpath = "";
    switch (sortPlace) {
        case 1:
        case "dislike":
            localpath = "delete";
            break;
        case 2:
        case "normal":
            localpath = "images" + separator + "normal" + separator;
            break;
        case 3:
        case "liked":
            localpath = "images" + separator + "liked" + separator;
            break;
        case 4:
        case "loved":
            localpath = "images" + separator + "loved" + separator;
            break;
        default:
            localpath = null;
    }
    if (localpath == null)
    {
        EMessage("sortPicture called with invalid args!");
    }
    else if (localpath == "delete")
    {
        myFile.delete();
        return true;
    }
    else
    {
        return taggedFile.move(getAppPath() + localpath + myFile.getName());
    }
    return false;
}
I really like the ability to move/sort files, but this function sort of goes above my level of coding :P
So I'm gonna copy it, but I wanna make a few modifications to it, but first I need something explained.
I understand the switch, and the second if statement, but the first if statement at the top of the code before the swithc, can you explain to me what is happening in more detail?

Best regards
Genome
That if statement just checks what format the file is provided to the function. It can be passed in as a java file, a Tease AI Java tagged file, a file path relative to TAJ, or a full file path. Does that make sense? If not I can explain further.
User avatar
genome231
Explorer At Heart
Explorer At Heart
Posts: 683
Joined: Wed Nov 12, 2014 8:35 am

Re: [Tease AI Java] TAJUtils Guide and Documentation

Post by genome231 »

Ah it makes sense now!

Thank you!
Tribute to 1885 & those involved with Tease-AI.
Thank you for spending time on this awesome project! :-)
ski23
Explorer At Heart
Explorer At Heart
Posts: 464
Joined: Sun Jun 11, 2017 12:53 am
Gender: Male
Sexual Orientation: Bisexual/Bi-Curious
I am a: Switch
Dom/me(s): Courtney
Sub/Slave(s): Courtney
Location: Virginia
Contact:

Re: [Tease AI Java] TAJUtils Guide and Documentation

Post by ski23 »

The Tease AI Developer Guide is now available here.
ski23
Explorer At Heart
Explorer At Heart
Posts: 464
Joined: Sun Jun 11, 2017 12:53 am
Gender: Male
Sexual Orientation: Bisexual/Bi-Curious
I am a: Switch
Dom/me(s): Courtney
Sub/Slave(s): Courtney
Location: Virginia
Contact:

Re: [Tease AI Java] TAJUtils Guide and Documentation

Post by ski23 »

TAJUTils just got an update in Mischevious 1.0.11
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests