[Tease AI Java] Developer's Guide and Help Thread

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

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

Re: [Tease AI Java] Developer's Guide and Help Thread

Post by genome231 »

To your second point because it’s a bit simpler, there is a showtaggedimage in TAJUtils.

So I want to learn from your stuff, but not actively use it. I prefer to try and create my own for learning purposes :-)
Second your showtaggedimage seems to be using your system with normal, liked and & loved that I dont plan on using, or maybe I dont fully understand it?

A few quick questions:

So in the old tease AI you could write a sentence like

Code: Select all

Hi there
And combine it with a specific picture shown

Code: Select all

Hi there @ShowImage()
Or a tag like, to make it shown a domme image with a corresponding tag:

Code: Select all

Hi there @GarmentsCovering
I dont see how I can combine a sendMessage with a specific picture being shown or utilize a tag?
Can you provide an example on how to do so?

What I basically want is absolutely full control over what images that gets shown at what points, either line specific, affected by time etc.

In regards to the random chat function:
Can you provide with a specific example of a function that enables me to return a random variable? In regards to it selecting one random sentence with a delay provided in it also? :-)

My idea for one was:

Code: Select all

function chat() {
	sendMessage(arguments[randomInteger(0, arguments.length - 1)],arguments[arguments.length]);
}
I can do it like this:

Code: Select all

sendMessage(random("hi","hello","morning"),randomInteger(2,5));
But would nice to have this in a single function :P

Best regards
Genome
Tribute to 1885 & those involved with Tease-AI.
Thank you for spending time on this awesome project! :-)
GodDragon
Explorer At Heart
Explorer At Heart
Posts: 790
Joined: Sun Jun 11, 2017 4:30 pm
Gender: Male
Sexual Orientation: Straight
I am a: Switch

Re: [Tease AI Java] Developer's Guide and Help Thread

Post by GodDragon »

genome231 wrote: Sun Nov 18, 2018 10:02 am To your second point because it’s a bit simpler, there is a showtaggedimage in TAJUtils.

So I want to learn from your stuff, but not actively use it. I prefer to try and create my own for learning purposes :-)
Second your showtaggedimage seems to be using your system with normal, liked and & loved that I dont plan on using, or maybe I dont fully understand it?

A few quick questions:

So in the old tease AI you could write a sentence like

Code: Select all

Hi there
And combine it with a specific picture shown

Code: Select all

Hi there @ShowImage()
Or a tag like, to make it shown a domme image with a corresponding tag:

Code: Select all

Hi there @GarmentsCovering
I dont see how I can combine a sendMessage with a specific picture being shown or utilize a tag?
Can you provide an example on how to do so?

What I basically want is absolutely full control over what images that gets shown at what points, either line specific, affected by time etc.

In regards to the random chat function:
Can you provide with a specific example of a function that enables me to return a random variable? In regards to it selecting one random sentence with a delay provided in it also? :-)

My idea for one was:

Code: Select all

function chat() {
	sendMessage(arguments[randomInteger(0, arguments.length - 1)],arguments[arguments.length]);
}
I can do it like this:

Code: Select all

sendMessage(random("hi","hello","morning"),randomInteger(2,5));
But would nice to have this in a single function :P

Best regards
Genome
Well regarding your original first question, this should work I guess:

Code: Select all

function chat() {
	let delay = arguments[0];
	
	if(delay !== parseInt(delay, 10)) {
		delay = randomInteger(2, 4)
	 }
	
	sendMessage(arguments[randomInteger(1, arguments.length - 1)], delay);
}

//Or the other way around chat(messages..., delay)
function chat() {
	let delay = arguments[arguments.length - 1];
	
	if(delay !== parseInt(delay, 10)) {
		delay = randomInteger(2, 4)
	 }
	
	sendMessage(arguments[randomInteger(0, arguments.length - 2)], delay);
}
Regarding your tagged picture thing: I will add a function that allows this. However for now you can go with this:

Code: Select all

function showTaggedImage() {
    var PictureSelector = Java.type("me.goddragon.teaseai.api.picture.PictureSelector");
    var DressState = Java.type("me.goddragon.teaseai.api.picture.DressState");
    var PictureTag = Java.type("me.goddragon.teaseai.api.picture.PictureTag");
    
    var ChatHandler = Java.type("me.goddragon.teaseai.api.chat.ChatHandler");
showPicture(ChatHandler.getHandler().getMainDomParticipant().getPictureSet().getRandomPicture(DressState.NAKED, PictureTag.FACE, PictureTag.BOOBS).getFile());
}
Here is a list of valid PictureTags: https://github.com/GodDragoner/TeaseAIJ ... reTag.java
And of the DressStates: https://github.com/GodDragoner/TeaseAIJ ... State.java
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] Developer's Guide and Help Thread

Post by ski23 »

genome231 wrote: Sun Nov 18, 2018 10:02 am To your second point because it’s a bit simpler, there is a showtaggedimage in TAJUtils.

So I want to learn from your stuff, but not actively use it. I prefer to try and create my own for learning purposes :-)
Second your showtaggedimage seems to be using your system with normal, liked and & loved that I dont plan on using, or maybe I dont fully understand it?

A few quick questions:

So in the old tease AI you could write a sentence like

Code: Select all

Hi there
And combine it with a specific picture shown

Code: Select all

Hi there @ShowImage()
Or a tag like, to make it shown a domme image with a corresponding tag:

Code: Select all

Hi there @GarmentsCovering
I dont see how I can combine a sendMessage with a specific picture being shown or utilize a tag?
Can you provide an example on how to do so?

What I basically want is absolutely full control over what images that gets shown at what points, either line specific, affected by time etc.

In regards to the random chat function:
Can you provide with a specific example of a function that enables me to return a random variable? In regards to it selecting one random sentence with a delay provided in it also? :-)

My idea for one was:

Code: Select all

function chat() {
	sendMessage(arguments[randomInteger(0, arguments.length - 1)],arguments[arguments.length]);
}
I can do it like this:

Code: Select all

sendMessage(random("hi","hello","morning"),randomInteger(2,5));
But would nice to have this in a single function :P

Best regards
Genome
So, I simplified my showTaggedImage method for you and removed the parts with the liked, normal, loved folders for you:

Code: Select all

function showTaggedImage(imagePath, imageTags, delay) {
    let path = teasePath + separator + imagePath;
    let pictureHandler = Java.type("me.goddragon.teaseai.api.picture.PictureHandler");
    DMessage("path " + path);
    DMessage("imageTags " + imageTags);
    let matchingImages = pictureHandler.getHandler().getTaggedPicturesExact(new java.io.File(path), imageTags);
    DMessage("matchingimages " + imageInt + " " + matchingImages);
    //YOU NEED TO CHECK IF MATCHING IMAGES IS NULL
    let randomImage = matchingImages.get(randomInteger(0, matchingImages.length - 1));

    let toReturn = showImage(randomImage.getFile().getPath());
    if (delay != null) {
        sleep(delay);
    }
    return toReturn;

}
You will still need to handle the case of what you want to do if the getTaggedPicturesExact function returned null which means no pictures were found in that folder with those tags. As for getting these to show in a message, you can use a runnable vocabulary for example, %showBoobsImage% inside of a message and then run whatever code you want inside the runnable vocabulary file.

I'd like to make TAJUtils an easy way to accomplish a lot of this without having to code it yourself. If there is something about TAJUtils that you would like more generalized to use, I can modify it.

As for your chat method, I really do think that having 2 methods is the better approach here because it allows you to have multiple random phrases in one message. However, here is a method that I believe should do what you want:

Code: Select all

function randomChat()
{
    var delay = false;
    var message = "";
    if (arguments.length < 2) {
        //This is an error. Shouldn't have called this with less than 2 args
        return;
    }
    if (arguments.length > 1) {
        if (!isNaN(arguments[arguments.length - 1]))
        {
            delay = arguments[arguments.length - 1];
        }
    }
    if (!delay) {
        message = arguments[randomInteger(0, arguments.length - 1)];
        CMessage(message, 0);
    }
    else
    {
        message = arguments[randomInteger(0, arguments.length - 2)];
        CMessage(message, delay);
    }
}
I see GodDragon beat me to this but maybe 2 implementations will be useful to you.
User avatar
genome231
Explorer At Heart
Explorer At Heart
Posts: 683
Joined: Wed Nov 12, 2014 8:35 am

Re: [Tease AI Java] Developer's Guide and Help Thread

Post by genome231 »

Thanks guys!

I'll give it a look and try and return if I hit a new "bumb".
Which will happen, I'm under no illusion! :lol:

Cheers :wave:

EDIT 1:
Runnables.
Dont understand it, but it's probably me overcomplicating it :-)
I'm reading the github: https://github.com/GodDragoner/TeaseAIJ ... /Runnables

So as I understand it: Runnables is a piece of code that runs all the time (unless cancelled or given a delay), meaning I can use it as something that runs all the time, or give som code a delay, a piece of code I want to run at a specific time.

Code: Select all

var TeaseRunnable = Java.type("me.goddragon.teaseai.api.runnable.TeaseRunnable");
var MyRunnable = Java.extend(TeaseRunnable , {
    run: function() {
        setTypeSpeed("INSTANT");
        sendMessage("Running runnable", 0);
	setTypeSpeed("MEDIUM");
    }
});
//Execute it every second with a first delay of 0
new MyRunnable().runTimer(0, 1000);

//OR

//Execute it every second with a first delay of 2000
new MyRunnable().runTimer(2000, 1000);

//OR

//Execute it once after 1 second
new MyRunnable().runLater(1000);
So first off:

Code: Select all

var TeaseRunnable = Java.type("me.goddragon.teaseai.api.runnable.TeaseRunnable");
var MyRunnable = Java.extend(TeaseRunnable , {
    run: function() {
        setTypeSpeed("INSTANT");
        sendMessage("Running runnable", 0);
	setTypeSpeed("MEDIUM");
    }
});
So as I read it (Let me know if I'm wrong):
The first line: is that like a package? Like telling the program this is how runnables work?
The second line: I'm creating a runnable called MyRunnable. <-- Does runnables not follow the camel naming convention?
The third line an so forth: It's a function where it will set the type speed to instant then send a message and then put the type speed back to Medium

Is that understood correctly?

The examples:

Code: Select all

new MyRunnable().runTimer(2000, 1000);
new MyRunnable().runLater(1000);
new MyRunnable().runTimer(0, 1000);
it's all given in "1000's", are they miliseconds?
What would happen if I wrote:

Code: Select all

new MyRunnable().runTimer(0,0);
Would that produce a bug, since it cannot run every "0" seconds? or would that just make it "run as often as possible?"
Also:
When creating a new runnable function, must they contain the keyword Runnable?

I hope my questions make sense :P

Cheers
Tribute to 1885 & those involved with Tease-AI.
Thank you for spending time on this awesome project! :-)
User avatar
genome231
Explorer At Heart
Explorer At Heart
Posts: 683
Joined: Wed Nov 12, 2014 8:35 am

Re: [Tease AI Java] Developer's Guide and Help Thread

Post by genome231 »

Regarding this one:

Code: Select all

function showTaggedImage() {
    var PictureSelector = Java.type("me.goddragon.teaseai.api.picture.PictureSelector");
    var DressState = Java.type("me.goddragon.teaseai.api.picture.DressState");
    var PictureTag = Java.type("me.goddragon.teaseai.api.picture.PictureTag");
    
    var ChatHandler = Java.type("me.goddragon.teaseai.api.chat.ChatHandler");
    showPicture(ChatHandler.getHandler().getMainDomParticipant().getPictureSet().getRandomPicture(DressState.NAKED, PictureTag.FACE, PictureTag.BOOBS).getFile());
}
Went with the one that seemed the simplest.
This one doesn't work for me, is there something I'm misunderstanding?
So first off:
This is my test script:

Code: Select all

sendMessage("Test_Start");
setTypeSpeed("INSTANT");
run("Functions/01_functions_Basic.js");
run("Functions/02_functions_Chat.js");
run("Functions/03_functions_Media.js");
run("Functions/04_functions_Stroking.js");
run("Functions/Routines/01_UpDown.js");
setTypeSpeed("MEDIUM");
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
sendMessage("Test_End", 60);
Currently for test purposes I only have 1 folder associated with the personality, so I'm sure it always chooses the same. In that folder i have exactly 4 pictures that has been tagged using the tagger built in TAJ:
It the folder with the 4 images contains a txt file with:

Code: Select all

4mQ_0001.JPG TagFullyDressed
4mQ_0014.JPG TagHalfDressed
4mQ_0045.JPG TagGarmentCovering
4mQ_0125.JPG TagNaked 
Help please, what am I missing? :-)
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] Developer's Guide and Help Thread

Post by ski23 »

genome231 wrote: Mon Nov 19, 2018 5:17 pm Regarding this one:

Code: Select all

function showTaggedImage() {
    var PictureSelector = Java.type("me.goddragon.teaseai.api.picture.PictureSelector");
    var DressState = Java.type("me.goddragon.teaseai.api.picture.DressState");
    var PictureTag = Java.type("me.goddragon.teaseai.api.picture.PictureTag");
    
    var ChatHandler = Java.type("me.goddragon.teaseai.api.chat.ChatHandler");
    showPicture(ChatHandler.getHandler().getMainDomParticipant().getPictureSet().getRandomPicture(DressState.NAKED, PictureTag.FACE, PictureTag.BOOBS).getFile());
}
Went with the one that seemed the simplest.
This one doesn't work for me, is there something I'm misunderstanding?
So first off:
This is my test script:

Code: Select all

sendMessage("Test_Start");
setTypeSpeed("INSTANT");
run("Functions/01_functions_Basic.js");
run("Functions/02_functions_Chat.js");
run("Functions/03_functions_Media.js");
run("Functions/04_functions_Stroking.js");
run("Functions/Routines/01_UpDown.js");
setTypeSpeed("MEDIUM");
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
sendMessage("Test_End", 60);
Currently for test purposes I only have 1 folder associated with the personality, so I'm sure it always chooses the same. In that folder i have exactly 4 pictures that has been tagged using the tagger built in TAJ:
It the folder with the 4 images contains a txt file with:

Code: Select all

4mQ_0001.JPG TagFullyDressed
4mQ_0014.JPG TagHalfDressed
4mQ_0045.JPG TagGarmentCovering
4mQ_0125.JPG TagNaked 
Help please, what am I missing? :-)
GodDragon’s ShowTaggedImage method will show a tagged image from the current set of domme images you are using. Mine should show one from the specified folder with the given tags. Try using mine and let me know if it is what you want.
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] Developer's Guide and Help Thread

Post by ski23 »

genome231 wrote: Mon Nov 19, 2018 3:52 pm Thanks guys!

I'll give it a look and try and return if I hit a new "bumb".
Which will happen, I'm under no illusion! :lol:

Cheers :wave:

EDIT 1:
Runnables.
Dont understand it, but it's probably me overcomplicating it :-)
I'm reading the github: https://github.com/GodDragoner/TeaseAIJ ... /Runnables

So as I understand it: Runnables is a piece of code that runs all the time (unless cancelled or given a delay), meaning I can use it as something that runs all the time, or give som code a delay, a piece of code I want to run at a specific time.

Code: Select all

var TeaseRunnable = Java.type("me.goddragon.teaseai.api.runnable.TeaseRunnable");
var MyRunnable = Java.extend(TeaseRunnable , {
    run: function() {
        setTypeSpeed("INSTANT");
        sendMessage("Running runnable", 0);
	setTypeSpeed("MEDIUM");
    }
});
//Execute it every second with a first delay of 0
new MyRunnable().runTimer(0, 1000);

//OR

//Execute it every second with a first delay of 2000
new MyRunnable().runTimer(2000, 1000);

//OR

//Execute it once after 1 second
new MyRunnable().runLater(1000);
So first off:

Code: Select all

var TeaseRunnable = Java.type("me.goddragon.teaseai.api.runnable.TeaseRunnable");
var MyRunnable = Java.extend(TeaseRunnable , {
    run: function() {
        setTypeSpeed("INSTANT");
        sendMessage("Running runnable", 0);
	setTypeSpeed("MEDIUM");
    }
});
So as I read it (Let me know if I'm wrong):
The first line: is that like a package? Like telling the program this is how runnables work?
The second line: I'm creating a runnable called MyRunnable. <-- Does runnables not follow the camel naming convention?
The third line an so forth: It's a function where it will set the type speed to instant then send a message and then put the type speed back to Medium

Is that understood correctly?

The examples:

Code: Select all

new MyRunnable().runTimer(2000, 1000);
new MyRunnable().runLater(1000);
new MyRunnable().runTimer(0, 1000);
it's all given in "1000's", are they miliseconds?
What would happen if I wrote:

Code: Select all

new MyRunnable().runTimer(0,0);
Would that produce a bug, since it cannot run every "0" seconds? or would that just make it "run as often as possible?"
Also:
When creating a new runnable function, must they contain the keyword Runnable?

I hope my questions make sense :P

Cheers
First off, let me say that runnables are a rather advanced topic and, you should really only use them when it is absolutely necessary. First off, I'll give you a few links to what a runnable is as a runnable isn't a TAJ concept. It is a common concept in Java and other high level languages.

Java Docs: https://docs.oracle.com/javase/7/docs/a ... nable.html
Good Guide: https://www.geeksforgeeks.org/runnable- ... e-in-java/
Stack Overflow: https://stackoverflow.com/questions/133 ... le-in-java

So, to put it most simply, a runnable is a task or set of code that you can schedule to run at a time. That can mean either making it run sometime in the future, or making it run over and over, or something else.

The first line isn't a package really. This is how you can interface with TAJ's java code. Here, we get the class called TeaseRunnable from TAJ. You can then use this like a type in java.
Naming convention doesn't actually affect anything in the code but they should follow camelCasing.
you can see the runTimer method as well as all of the other one and their parameters in the JavaDocs linked above.
They don't need the word runnable. That is just the name of the variable. Variable names NEVER affect anything in the code unless they are the same as a keyword.
Let me know if you have any other questions. I hope this helps!
User avatar
genome231
Explorer At Heart
Explorer At Heart
Posts: 683
Joined: Wed Nov 12, 2014 8:35 am

Re: [Tease AI Java] Developer's Guide and Help Thread

Post by genome231 »

ski23 wrote: Mon Nov 19, 2018 6:08 pm GodDragon’s ShowTaggedImage method will show a tagged image from the current set of domme images you are using. Mine should show one from the specified folder with the given tags. Try using mine and let me know if it is what you want.
Gonna give yours a go.
Basically I would be fine with just using it on the current set of domme images, but yours is nice in the way that it gives more freedom :)

Just to be sure I understand it correctly :)

showTaggedImage() would for instance be:

Code: Select all

showTaggedImage("Images/GNM_Images/Charlotte/1" , "TagGarmentCovering" , 5);
Regarding runnables:
You mentioned:
ski23 wrote: Mon Nov 19, 2018 6:08 pm You will still need to handle the case of what you want to do if the getTaggedPicturesExact function returned null which means no pictures were found in that folder with those tags. As for getting these to show in a message, you can use a runnable vocabulary for example, %showBoobsImage% inside of a message and then run whatever code you want inside the runnable vocabulary file.
Can you give an example of how it would work with a vocabulary?

Cheers :-)
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] Developer's Guide and Help Thread

Post by ski23 »

genome231 wrote: Mon Nov 19, 2018 7:27 pm
ski23 wrote: Mon Nov 19, 2018 6:08 pm GodDragon’s ShowTaggedImage method will show a tagged image from the current set of domme images you are using. Mine should show one from the specified folder with the given tags. Try using mine and let me know if it is what you want.
Gonna give yours a go.
Basically I would be fine with just using it on the current set of domme images, but yours is nice in the way that it gives more freedom :)

Just to be sure I understand it correctly :)

showTaggedImage() would for instance be:

Code: Select all

showTaggedImage("Images/GNM_Images/Charlotte/1" , "TagGarmentCovering" , 5);
Regarding runnables:
You mentioned:
ski23 wrote: Mon Nov 19, 2018 6:08 pm You will still need to handle the case of what you want to do if the getTaggedPicturesExact function returned null which means no pictures were found in that folder with those tags. As for getting these to show in a message, you can use a runnable vocabulary for example, %showBoobsImage% inside of a message and then run whatever code you want inside the runnable vocabulary file.
Can you give an example of how it would work with a vocabulary?

Cheers :-)
So, for the taggedImage function, here is an example of how you could call it:

Code: Select all

showTaggedImage("Images/liked", ["boobs"], 1);
or if you wanted to use multiple tags:

Code: Select all

showTaggedImage("Images/liked", ["boobs", "ass", "pussy"], 1);
So, you are passing it an array of tags. That's why it is in the format [].
Also, I saw the code I gave you and, you might want to just remove the DMessage debug message lines because I noticed that on one of them, I was referencing a variable that doesn't exist anymore so that would give an error.

As for your runnable question, I hope that you aren't mixing up "runnables" and "runnable vocabulary". "Runnables" are a task that will run at a certain point in time as I outlined above. "Runnable vocabularies" on the other hand, are something entirely different which is a vocabulary that, when called, will run code. Here is an example:
I could run this message:

Code: Select all

CMessage("This is an example message %ShowBoobsImage%")
Normally, when a vocabulary is used like in this example, it will look for a vocabulary file in the vocabularies folder with the matching name. However, you can make that file a javascript file instead of a text file as shown here.
In my example, in Mischevious, in the vocabularies folder, I have a file called ShowBoobsImage.js and, the code inside of that method is here (Note that I am using my own version of showTaggedImage which is different than the one I just showed you):

Code: Select all

function showBoobsImageVocabulary() {
    DMessage("ShowBoobsImage: Beginning");
    showTaggedImage(4, ["boobs"]);
    DMessage("ShowBoobsImage: End");
    return "";
}
GodDragon
Explorer At Heart
Explorer At Heart
Posts: 790
Joined: Sun Jun 11, 2017 4:30 pm
Gender: Male
Sexual Orientation: Straight
I am a: Switch

Re: [Tease AI Java] Developer's Guide and Help Thread

Post by GodDragon »

genome231 wrote: Mon Nov 19, 2018 3:52 pm
Spoiler: show
Thanks guys!

I'll give it a look and try and return if I hit a new "bumb".
Which will happen, I'm under no illusion! :lol:

Cheers :wave:

EDIT 1:
Runnables.
Dont understand it, but it's probably me overcomplicating it :-)
I'm reading the github: https://github.com/GodDragoner/TeaseAIJ ... /Runnables

So as I understand it: Runnables is a piece of code that runs all the time (unless cancelled or given a delay), meaning I can use it as something that runs all the time, or give som code a delay, a piece of code I want to run at a specific time.

Code: Select all

var TeaseRunnable = Java.type("me.goddragon.teaseai.api.runnable.TeaseRunnable");
var MyRunnable = Java.extend(TeaseRunnable , {
    run: function() {
        setTypeSpeed("INSTANT");
        sendMessage("Running runnable", 0);
	setTypeSpeed("MEDIUM");
    }
});
//Execute it every second with a first delay of 0
new MyRunnable().runTimer(0, 1000);

//OR

//Execute it every second with a first delay of 2000
new MyRunnable().runTimer(2000, 1000);

//OR

//Execute it once after 1 second
new MyRunnable().runLater(1000);
So first off:

Code: Select all

var TeaseRunnable = Java.type("me.goddragon.teaseai.api.runnable.TeaseRunnable");
var MyRunnable = Java.extend(TeaseRunnable , {
    run: function() {
        setTypeSpeed("INSTANT");
        sendMessage("Running runnable", 0);
	setTypeSpeed("MEDIUM");
    }
});
So as I read it (Let me know if I'm wrong):
The first line: is that like a package? Like telling the program this is how runnables work?
The second line: I'm creating a runnable called MyRunnable. <-- Does runnables not follow the camel naming convention?
The third line an so forth: It's a function where it will set the type speed to instant then send a message and then put the type speed back to Medium

Is that understood correctly?

The examples:

Code: Select all

new MyRunnable().runTimer(2000, 1000);
new MyRunnable().runLater(1000);
new MyRunnable().runTimer(0, 1000);
it's all given in "1000's", are they miliseconds?
What would happen if I wrote:

Code: Select all

new MyRunnable().runTimer(0,0);
Would that produce a bug, since it cannot run every "0" seconds? or would that just make it "run as often as possible?"
Also:
When creating a new runnable function, must they contain the keyword Runnable?

I hope my questions make sense :P

Cheers
The parameters are in milliseconds. I would not try to use runTimer(0, 0). It will run as often as possible and probably heavily slow down your personality.
genome231 wrote: Mon Nov 19, 2018 5:17 pm
Spoiler: show
Regarding this one:

Code: Select all

function showTaggedImage() {
    var PictureSelector = Java.type("me.goddragon.teaseai.api.picture.PictureSelector");
    var DressState = Java.type("me.goddragon.teaseai.api.picture.DressState");
    var PictureTag = Java.type("me.goddragon.teaseai.api.picture.PictureTag");
    
    var ChatHandler = Java.type("me.goddragon.teaseai.api.chat.ChatHandler");
    showPicture(ChatHandler.getHandler().getMainDomParticipant().getPictureSet().getRandomPicture(DressState.NAKED, PictureTag.FACE, PictureTag.BOOBS).getFile());
}
Went with the one that seemed the simplest.
This one doesn't work for me, is there something I'm misunderstanding?
So first off:
This is my test script:

Code: Select all

sendMessage("Test_Start");
setTypeSpeed("INSTANT");
run("Functions/01_functions_Basic.js");
run("Functions/02_functions_Chat.js");
run("Functions/03_functions_Media.js");
run("Functions/04_functions_Stroking.js");
run("Functions/Routines/01_UpDown.js");
setTypeSpeed("MEDIUM");
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
showTaggedImage("TagFullyDressed");
sleep(2);
sendMessage("Test_End", 60);
Currently for test purposes I only have 1 folder associated with the personality, so I'm sure it always chooses the same. In that folder i have exactly 4 pictures that has been tagged using the tagger built in TAJ:
It the folder with the 4 images contains a txt file with:

Code: Select all

4mQ_0001.JPG TagFullyDressed
4mQ_0014.JPG TagHalfDressed
4mQ_0045.JPG TagGarmentCovering
4mQ_0125.JPG TagNaked 
Help please, what am I missing? :-)
My function was not meant to work with parameters and was just an example of how you could do it. If you are still looking to implement it that way I can work on something but maybe you are better of with ski's approach.
User avatar
genome231
Explorer At Heart
Explorer At Heart
Posts: 683
Joined: Wed Nov 12, 2014 8:35 am

Re: [Tease AI Java] Developer's Guide and Help Thread

Post by genome231 »

Maybe one of you can explain why this doesn't work for me :P

So trying this function:

Code: Select all

showTaggedPic("Images/General_Pics/Charlotte Springer/1",["TagFullyDressed"],2);
Which I believe has the correct path, tagname and delay.
This is my path from where TAJ is stored
TeaseAI_Java\Images\General_Pics\Charlotte Springer\1\

The function is loaded from this, where I've probably made a mistake:

Code: Select all

function showTaggedPic(imagePath, imageTags, delay) {
    let path = teasePath + separator + imagePath;
    let pictureHandler = Java.type("me.goddragon.teaseai.api.picture.PictureHandler");
    let matchingImages = pictureHandler.getHandler().getTaggedPicturesExact(new java.io.File(path), imageTags);
    if (matchingImages === null) {
    	sendMessage("BUG: matchingImages was equal to null",4);
    } else {
    	let randomImage = matchingImages.get(randomInteger(0, matchingImages.length - 1));
    	let toReturn = showImage(randomImage.getFile().getPath());
    if (delay != null) {
        sleep(delay);
    }
    return toReturn;
    }
}
What am I doing wrong?

Cheers
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] Developer's Guide and Help Thread

Post by ski23 »

genome231 wrote: Wed Nov 21, 2018 4:58 pm Maybe one of you can explain why this doesn't work for me :P

So trying this function:

Code: Select all

showTaggedPic("Images/General_Pics/Charlotte Springer/1",["TagFullyDressed"],2);
Which I believe has the correct path, tagname and delay.
This is my path from where TAJ is stored
TeaseAI_Java\Images\General_Pics\Charlotte Springer\1\

The function is loaded from this, where I've probably made a mistake:

Code: Select all

function showTaggedPic(imagePath, imageTags, delay) {
    let path = teasePath + separator + imagePath;
    let pictureHandler = Java.type("me.goddragon.teaseai.api.picture.PictureHandler");
    let matchingImages = pictureHandler.getHandler().getTaggedPicturesExact(new java.io.File(path), imageTags);
    if (matchingImages === null) {
    	sendMessage("BUG: matchingImages was equal to null",4);
    } else {
    	let randomImage = matchingImages.get(randomInteger(0, matchingImages.length - 1));
    	let toReturn = showImage(randomImage.getFile().getPath());
    if (delay != null) {
        sleep(delay);
    }
    return toReturn;
    }
}
What am I doing wrong?

Cheers
It looks like you are trying to use the teasePath variable that was in my code. That was a global variable that represents the current tease path. Replace that with whatever your version would be or if you don’t have a global tease path variable, just make it a local variable and copy from where I initialized teasePath in mediaUtils.
If it still doesn’t work, however, can you give me the error message from the logs or if there isn’t an error message describe what about the behavior isn’t working.
User avatar
genome231
Explorer At Heart
Explorer At Heart
Posts: 683
Joined: Wed Nov 12, 2014 8:35 am

Re: [Tease AI Java] Developer's Guide and Help Thread

Post by genome231 »

Okay!

So I feel like I'm almost there, but something is still eluding me...

So this is run in the setup.

Code: Select all

let separator = java.io.File.separator; //Why is this necessary?
let teasePath;

function setUpMedia() {
    let TeaseAI = Java.type("me.goddragon.teaseai.TeaseAI");
    let file = new java.io.File(TeaseAI.class.getProtectionDomain().getCodeSource().getLocation().toURI());
    //The path to the main directory
    teasePath = file.getParent();
    sendMessage(teasePath); //Produces the correct path, tested it.
}
So I'm confident this part works. Because the sendMessage at the end produces the right path.
The full path for which I'm testing is:

A:\TeaseAI_Java\Images\General_Pics\Charlotte Springer\1
and sendMessage(teasePath); produces A:\TeaseAI_Java when I test it.

So there seems to be something wrong with this one..

Code: Select all

function showTaggedPic(imagePath, imageTags, delay) {
    let path = teasePath + separator + imagePath;
    let pictureHandler = Java.type("me.goddragon.teaseai.api.picture.PictureHandler");
    let matchingImages = pictureHandler.getHandler().getTaggedPicturesExact(new java.io.File(path), imageTags);
    if (matchingImages === null) {
    	sendMessage("BUG: matchingImages was equal to null",4);
    } else {
    	let randomImage = matchingImages.get(randomInteger(0, matchingImages.length - 1));
    	let toReturn = showImage(randomImage.getFile().getPath());
    if (delay != null) {
        sleep(delay);
    }
    return toReturn;
    }
}
This is my test file:

Code: Select all

sendMessage("Test_Start");
setTypeSpeed("INSTANT");
run("Functions/01_functions_Basic.js");
run("Functions/02_functions_Chat.js");
run("Functions/03_functions_Media.js");
run("Functions/04_functions_Stroking.js");
run("Functions/05_functions_Structure.js");
run("Functions/06_functions_Check.js");
sendMessage("Loading stroking routines");
setUpMedia();
setTypeSpeed("MEDIUM");
showTaggedPic("Images/General_Pics/Charlotte Springer/1",["TagFullyDressed"],5);
sendMessage("Test_End", 60);
When it runs the showTaggedPic it produces the error: sendMessage("BUG: matchingImages was equal to null",4);

What is it that I'm missing or not quite getting and please get into details :P I'm very new at this.

Cheers
And thank you for all the patience so far xD
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] Developer's Guide and Help Thread

Post by ski23 »

genome231 wrote: Sun Nov 25, 2018 3:36 pm Okay!

So I feel like I'm almost there, but something is still eluding me...

So this is run in the setup.

Code: Select all

let separator = java.io.File.separator; //Why is this necessary?
let teasePath;

function setUpMedia() {
    let TeaseAI = Java.type("me.goddragon.teaseai.TeaseAI");
    let file = new java.io.File(TeaseAI.class.getProtectionDomain().getCodeSource().getLocation().toURI());
    //The path to the main directory
    teasePath = file.getParent();
    sendMessage(teasePath); //Produces the correct path, tested it.
}
So I'm confident this part works. Because the sendMessage at the end produces the right path.
The full path for which I'm testing is:

A:\TeaseAI_Java\Images\General_Pics\Charlotte Springer\1
and sendMessage(teasePath); produces A:\TeaseAI_Java when I test it.

So there seems to be something wrong with this one..

Code: Select all

function showTaggedPic(imagePath, imageTags, delay) {
    let path = teasePath + separator + imagePath;
    let pictureHandler = Java.type("me.goddragon.teaseai.api.picture.PictureHandler");
    let matchingImages = pictureHandler.getHandler().getTaggedPicturesExact(new java.io.File(path), imageTags);
    if (matchingImages === null) {
    	sendMessage("BUG: matchingImages was equal to null",4);
    } else {
    	let randomImage = matchingImages.get(randomInteger(0, matchingImages.length - 1));
    	let toReturn = showImage(randomImage.getFile().getPath());
    if (delay != null) {
        sleep(delay);
    }
    return toReturn;
    }
}
This is my test file:

Code: Select all

sendMessage("Test_Start");
setTypeSpeed("INSTANT");
run("Functions/01_functions_Basic.js");
run("Functions/02_functions_Chat.js");
run("Functions/03_functions_Media.js");
run("Functions/04_functions_Stroking.js");
run("Functions/05_functions_Structure.js");
run("Functions/06_functions_Check.js");
sendMessage("Loading stroking routines");
setUpMedia();
setTypeSpeed("MEDIUM");
showTaggedPic("Images/General_Pics/Charlotte Springer/1",["TagFullyDressed"],5);
sendMessage("Test_End", 60);
When it runs the showTaggedPic it produces the error: sendMessage("BUG: matchingImages was equal to null",4);

What is it that I'm missing or not quite getting and please get into details :P I'm very new at this.

Cheers
And thank you for all the patience so far xD
So there are a couple issues I see. The first one isn't really causing your issue but it's important to note. In your function, you print out that if matchingImages is null, it is a bug. That isn't true. If you call showTaggedPic("Images/General_Pics/Charlotte Springer/1",["Boobs"],5); and there aren't any images that have the tag boobs, then that isn't a bug. It just means none were found and you should do whatever you want in that case.
Second, for why separator is at the top, don't use "\" in your paths. "\" will cancel out the meaning of the next character. So, for example, if you wanted to print out a quotation mark, you would do it like this "\"" because it will nullify the special meaning of the quotation mark. It is possible to use "\\" instead. However, DON'T do this because it will be incompatible with MacOs and Linux. Instead, in paths, you should always use "/" or use the separator variable at the top. (I recommend using the separator var)
Third, don't include tag in the tag name, just the name. For example, use "boobs" not "TagBoobs".
Finally, I checked and the showTaggedImagesExact function only shows images with the provided tags and will not search for dress states such as "naked", "halfdressed", "fullydressed", etc. I'll change this when I get the chance though. For now, try using any tags listed in the tags list with the other changes above.
Last edited by ski23 on Sun Nov 25, 2018 7:41 pm, edited 1 time in total.
GodDragon
Explorer At Heart
Explorer At Heart
Posts: 790
Joined: Sun Jun 11, 2017 4:30 pm
Gender: Male
Sexual Orientation: Straight
I am a: Switch

Re: [Tease AI Java] Developer's Guide and Help Thread

Post by GodDragon »

ski23 wrote: Sun Nov 25, 2018 6:53 pm
genome231 wrote: Sun Nov 25, 2018 3:36 pm Okay!

So I feel like I'm almost there, but something is still eluding me...

So this is run in the setup.

Code: Select all

let separator = java.io.File.separator; //Why is this necessary?
let teasePath;

function setUpMedia() {
    let TeaseAI = Java.type("me.goddragon.teaseai.TeaseAI");
    let file = new java.io.File(TeaseAI.class.getProtectionDomain().getCodeSource().getLocation().toURI());
    //The path to the main directory
    teasePath = file.getParent();
    sendMessage(teasePath); //Produces the correct path, tested it.
}
So I'm confident this part works. Because the sendMessage at the end produces the right path.
The full path for which I'm testing is:

A:\TeaseAI_Java\Images\General_Pics\Charlotte Springer\1
and sendMessage(teasePath); produces A:\TeaseAI_Java when I test it.

So there seems to be something wrong with this one..

Code: Select all

function showTaggedPic(imagePath, imageTags, delay) {
    let path = teasePath + separator + imagePath;
    let pictureHandler = Java.type("me.goddragon.teaseai.api.picture.PictureHandler");
    let matchingImages = pictureHandler.getHandler().getTaggedPicturesExact(new java.io.File(path), imageTags);
    if (matchingImages === null) {
    	sendMessage("BUG: matchingImages was equal to null",4);
    } else {
    	let randomImage = matchingImages.get(randomInteger(0, matchingImages.length - 1));
    	let toReturn = showImage(randomImage.getFile().getPath());
    if (delay != null) {
        sleep(delay);
    }
    return toReturn;
    }
}
This is my test file:

Code: Select all

sendMessage("Test_Start");
setTypeSpeed("INSTANT");
run("Functions/01_functions_Basic.js");
run("Functions/02_functions_Chat.js");
run("Functions/03_functions_Media.js");
run("Functions/04_functions_Stroking.js");
run("Functions/05_functions_Structure.js");
run("Functions/06_functions_Check.js");
sendMessage("Loading stroking routines");
setUpMedia();
setTypeSpeed("MEDIUM");
showTaggedPic("Images/General_Pics/Charlotte Springer/1",["TagFullyDressed"],5);
sendMessage("Test_End", 60);
When it runs the showTaggedPic it produces the error: sendMessage("BUG: matchingImages was equal to null",4);

What is it that I'm missing or not quite getting and please get into details :P I'm very new at this.

Cheers
And thank you for all the patience so far xD
Second, don't use "/" in your paths. "/" will cancel out the meaning of the next character. So, for example, if you wanted to print out a quotation mark, you would do it like this "/"" because it will nullify the special meaning of the quotation mark. It is possible to use "//" instead. However, DON'T do this because it will be incompatible with MacOs and Linux. Instead, in paths, you should always use "\" or use the separator variable at the top. (I recommend using the separator var)
Actually \ is used to escape the next character not / :-)
Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests