[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 »

GodDragon wrote: Wed Jan 09, 2019 3:40 pm
First letter of the function needs to be lower case as in the warning: testVocabulary instead of TestVocabulary (case sensitive)
Thanks :-)
Tribute to 1885 & those involved with Tease-AI.
Thank you for spending time on this awesome project! :-)
heftigeruser
Explorer
Explorer
Posts: 10
Joined: Fri Sep 29, 2017 8:59 am

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

Post by heftigeruser »

Hey,
right now im trying to meddle in programming a little something but i have basically no experience in JavaScript/Java so i google whenever i have a question but during testing i have come to a few problems and maybe someone will help me.

answer = getInput("How old are you? (in years)");
while(isNaN(answer)){
CMessage("Please enter a number");
answer = getInput("How old are you?");
}

this doesnt work, so i assume that the input is always saved as a string, is there an easy way to check if something is a number?

another thing, is there an easy way to have the dome ask the question again if the input does not meet any of the cases?
like if i have a yes or no question:

answer = getInput("Are you new to this Chatprogramm?")
if (answer.isLike("yes"))
{
CMessage("Thats great %SubName%, I hope you have set everything up properly.");
}
else if (answer.isLike("no))
{
CMessage("So you have used this programm before.")
}

if the user now inputs something different from yes or no weird stuff happens, but i would like for the programm to just start over at: "answer = getInput("Are you new to this Chatprogramm?")"

also when i change a variable i set up in the .var format in the variables folder the programm seems to load the value from somewhere else, and just ignore the change and i dont know why

thanks in advance
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 »

heftigeruser wrote: Sun Jan 27, 2019 12:11 pm Hey,
right now im trying to meddle in programming a little something but i have basically no experience in JavaScript/Java so i google whenever i have a question but during testing i have come to a few problems and maybe someone will help me.

answer = getInput("How old are you? (in years)");
while(isNaN(answer)){
CMessage("Please enter a number");
answer = getInput("How old are you?");
}

this doesnt work, so i assume that the input is always saved as a string, is there an easy way to check if something is a number?

another thing, is there an easy way to have the dome ask the question again if the input does not meet any of the cases?
like if i have a yes or no question:

answer = getInput("Are you new to this Chatprogramm?")
if (answer.isLike("yes"))
{
CMessage("Thats great %SubName%, I hope you have set everything up properly.");
}
else if (answer.isLike("no))
{
CMessage("So you have used this programm before.")
}

if the user now inputs something different from yes or no weird stuff happens, but i would like for the programm to just start over at: "answer = getInput("Are you new to this Chatprogramm?")"

also when i change a variable i set up in the .var format in the variables folder the programm seems to load the value from somewhere else, and just ignore the change and i dont know why

thanks in advance
Integer Answer:
https://github.com/GodDragoner/Spicy-TA ... on.js#L104

So answer.isInteger() and answer.getInteger() are built in functions in TAJ.

Yes. If you want to ask the same question again you can use answer.loop(). This will not resend the inital text but you can do that manually. Example:
https://github.com/GodDragoner/Spicy-TA ... on.js#L108



During runtime variables are stored in the RAM and not loaded from the disk which speeds up performance and lowers disk usage. You can change variables at run time in the settings menu under the debug option. (You need to tick: Show unsupported variables)
lotar232
Explorer
Explorer
Posts: 76
Joined: Sat Nov 01, 2008 6:34 pm

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

Post by lotar232 »

hi...
I'm looking for a combination method of getting input that:
1) doesn't disturb the previous picture (or send the message from the main sender... ...like createinput)
2) supports a timeout option so after ~3 minutes answer.timeout triggers (like the way sendinput does)

I can't get sendinput or createinput to work because:
a trailing integer passed to create input gets interpreted as an additional option to display... not a timeout...
I don't know of a way to suppress sender image and name in sendInput.



(essentially I'm working on a "study mode" in spicy" where typing exit will trigger an exit routine, but periodically the timer will go off triggering an action)


I suppose I could register an "exit" response and then filter out usage based on the current code flow, but that seems more complex..

any suggestions?

cheers,
ilikelatex
Explorer
Explorer
Posts: 30
Joined: Sat Aug 26, 2017 4:34 pm

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

Post by ilikelatex »

I'm used to the chatutils.js from ski's HouseOfTease on github (https://github.com/skier233/House-Of-Tease-Java). But maybe this helps, or you can adopt the getInput() from there or integrate the chatutils. If you want to use another sender then domme or friends, you can set sender=5 but then you have to create the name and color on your own. I think there is also a function to register a new sender, but i don't know how that works.

Example:

Code: Select all

function test(){
	let study = true;
	let delay = -1;
	let sender = 3;
	SMessage("Study time", delay, sender);
	showTeaseImage();
	lockImages();
	while(study) {
		let answer = getInput("<dontsend>", randomInteger(120,240), delay, true, sender );
		//function getInput(message, timeout, delay, disableResponses=true, sender)	
		//from ski's HouseOfTease Chatutils
		while (true) {
			if (answer.isLike("exit") ) {
				unlockImages()
				//home(); return to main screen
				break;
			} else if(answer.isTimeout()) {
				SMessage("Let's have some fun", delay, sender);
				unlockImages()
				//do something
				break;
				//or loop again
			} else {
				SMessage("What did you say?", delay, sender);
				answer.loop();		//timeout gets resetted
		   }
		}
		break;
	}
	SMessage("End", delay, sender);
	wait(10);
	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 »

lotar232 wrote: Mon Jan 28, 2019 2:00 am hi...
I'm looking for a combination method of getting input that:
1) doesn't disturb the previous picture (or send the message from the main sender... ...like createinput)
2) supports a timeout option so after ~3 minutes answer.timeout triggers (like the way sendinput does)

I can't get sendinput or createinput to work because:
a trailing integer passed to create input gets interpreted as an additional option to display... not a timeout...
I don't know of a way to suppress sender image and name in sendInput.



(essentially I'm working on a "study mode" in spicy" where typing exit will trigger an exit routine, but periodically the timer will go off triggering an action)


I suppose I could register an "exit" response and then filter out usage based on the current code flow, but that seems more complex..

any suggestions?

cheers,
Based on the api docs, you need to pass the timeout before other options. Like this:
"createInput(int secondsTillTimeout, String... options)"
Keep in mind that creating any input automatically waits for an input and does not continue the code unless timeout is triggered or a chat message is send. If you want to have a passive option I would suggest using a runnable vocabulary ;)

Found here:
https://github.com/GodDragoner/TeaseAIJ ... ng-options ;-)
lotar232
Explorer
Explorer
Posts: 76
Joined: Sat Nov 01, 2008 6:34 pm

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

Post by lotar232 »

GodDragon wrote: Mon Jan 28, 2019 11:52 am
lotar232 wrote: Mon Jan 28, 2019 2:00 am hi...
I'm looking for a combination method of getting input that:
1) doesn't disturb the previous picture (or send the message from the main sender... ...like createinput)
2) supports a timeout option so after ~3 minutes answer.timeout triggers (like the way sendinput does)

I can't get sendinput or createinput to work because:
a trailing integer passed to create input gets interpreted as an additional option to display... not a timeout...
I don't know of a way to suppress sender image and name in sendInput.



(essentially I'm working on a "study mode" in spicy" where typing exit will trigger an exit routine, but periodically the timer will go off triggering an action)


I suppose I could register an "exit" response and then filter out usage based on the current code flow, but that seems more complex..

any suggestions?

cheers,
Based on the api docs, you need to pass the timeout before other options. Like this:
"createInput(int secondsTillTimeout, String... options)"
Keep in mind that creating any input automatically waits for an input and does not continue the code unless timeout is triggered or a chat message is send. If you want to have a passive option I would suggest using a runnable vocabulary ;)

Found here:
https://github.com/GodDragoner/TeaseAIJ ... ng-options ;-)
Thanks that works! (I think I was confused by the parameter being on the end for sendmessages, not sure how I missed that in the wiki).... in this particular scenario the behavior works because basically you're waiting for a timeout to take some periodic action, and the send input is only to collect a request to exit.
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 »

lotar232 wrote: Mon Jan 28, 2019 6:09 pm
GodDragon wrote: Mon Jan 28, 2019 11:52 am
lotar232 wrote: Mon Jan 28, 2019 2:00 am hi...
I'm looking for a combination method of getting input that:
1) doesn't disturb the previous picture (or send the message from the main sender... ...like createinput)
2) supports a timeout option so after ~3 minutes answer.timeout triggers (like the way sendinput does)

I can't get sendinput or createinput to work because:
a trailing integer passed to create input gets interpreted as an additional option to display... not a timeout...
I don't know of a way to suppress sender image and name in sendInput.



(essentially I'm working on a "study mode" in spicy" where typing exit will trigger an exit routine, but periodically the timer will go off triggering an action)


I suppose I could register an "exit" response and then filter out usage based on the current code flow, but that seems more complex..

any suggestions?

cheers,
Based on the api docs, you need to pass the timeout before other options. Like this:
"createInput(int secondsTillTimeout, String... options)"
Keep in mind that creating any input automatically waits for an input and does not continue the code unless timeout is triggered or a chat message is send. If you want to have a passive option I would suggest using a runnable vocabulary ;)

Found here:
https://github.com/GodDragoner/TeaseAIJ ... ng-options ;-)
Thanks that works! (I think I was confused by the parameter being on the end for sendmessages, not sure how I missed that in the wiki).... in this particular scenario the behavior works because basically you're waiting for a timeout to take some periodic action, and the send input is only to collect a request to exit.
Glad u got it working!
Zefram
Explorer
Explorer
Posts: 6
Joined: Sun Feb 03, 2019 11:27 am

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

Post by Zefram »

My Java Development Setup

The Java sources for TAJ are currently provided without a standard way to build. As a non Java expert I
struggled to get started with debugging or building the software. Sharing what I did may help others -
I don't claim this it is good enough for production but it helped me running the Java debugger and understanding some behavior of TAJ.

While this setup is aimed at Java development the directory setup is suitable for keeping an eye on your Personality JavaScript code and moving that forward. It is assumed you have basic understanding of how to work on the terminal and install Java on your computer.

On my Mac this is working with
  • Mac OSX 10.13
  • Java 11
  • TAJ 1.0.17/18
Everything should also work on Windows as only platform independent tools were used assuming you have installed GitBash (or know your way around Windows and do some minor adjustments).

In the following I'll describe how to:
  • set up the tool-chain
  • build the TAJ software
  • set up Visual Studio Code to debug the Java code
Why is building so difficult? Is there not a standard way? The issue is that there are many standard ways. There are 3 main ways to build Java software: Ant, Maven and Gradle. In addition there are IDEs which may provide built-in capabilities. Almost last but not least IDEs generate build files that are overly complex and don't hold up so well in other setups. Finally complexity is added by tools and IDEs having opinions about directory layouts.

Just to make life even harder over the past years Java got a module system and it was decided to move JavaFX out of the Java 11 distribution. Which requires TAJ to dynamically download JavaFX when it first starts up and then to restart itself complicating development and debugging setup. Doing this so it works well for others and covers development, testing and distribution is hard so I understand why there is not one yet. I figured I only needed it working for playing around which should be easier so here it goes...

Setting up the tool-chain

Java 11
I downloaded the Java SDK from Oracle but OpenJDK should be fine too. Make sure the following two environment variables are set correctly (Oracle version, otherwise set them in your ~/.bash_profile or wherever you do this).

Code: Select all

    export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home
    export JDK_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home
Start a fresh shell and check java is there and has the right version with java --version. OpenJdk users may have to adjust their shell's PATH variable.

TAJ
  • Download and unzip the TAJ distribution
  • Rename the new directory and remove the version and spaces in the directory name. Do this now, not sure how safe it is to do it later.
  • Create in Images a "Domme" folder and within it another folder called "1". Place a few pictures into the "1" folder
  • Right click on the TeaseAI.jar and lauch it (or from the command line: java -jar TeaseAI.jar)
  • Download the update (if offered) and the JavaFX.
  • In the Settings->Contacts->"Dom Name" point the "Image Sets Path" to your "Domme" folder and save the settings.
  • When you now Start the default personality your pictures should show up.
This is half way, later Maven and Visual Studio Code need to be installed.

Development directory setup


I wanted to have my development directory set up in a way I maximize the sharing with the "normal" TAJ directory. The development happens in the "DevDir" subdirectory relative to the previously downloaded and at least one run(!) TAJ installation and there are lot of symlinks.

Code: Select all

git clone https://github.com/GodDragoner/TeaseAIJava.git DevDir
cd DevDir
ln -s ../javafx-sdk-11 javafx-sdk-11
ln -s ../Images Images
ln -s ../Videos Videos
ln -s ../Personalities Personalities
ln -s ../TeaseAI.properties TeaseAI.properties
mkdir target
ln -s target/TeaseAi-1.0-SNAPSHOT.jar TeaseAI.jar
  • You do not need the build the software in order to debug it. If you want to debug the internet distribution the you could simply do an ln -s ../TeaseAI.jar TeaseAI.jar and use the development directory and debugger setup (below) this way.
Build setup

I decided to use Maven to build the software. It may not be great but it is independent of any IDE and as the POM has been written by me manually it is reasonably understandable (as pom files go). The build file creates a target/TeaseAi-1.0-SNAPSHOT.jar which contains still way too much but it seems to be running and can be debugged which is good enough for me for the time being.
  • Download and unzip a recent Maven distribution, I used 3.6.0. Make sure mvn is in your PATH or have set an alias to ...yourplace.../apache-maven-3.6.0/bin/mvn. You should be able to do "mvn --version" in the terminal.
  • Maven uses a pom.xml file in the DevDir to build the software. Create the pom.xml file with following content:
Spoiler: show

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>me.goddragon</groupId>
    <artifactId>TeaseAi</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>TeaseAi</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <mainClass>me.goddragon.teaseai.MainApp</mainClass>
    </properties>

    <organization>
        <name>Your Organisation</name>
    </organization>

    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>11</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>11</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-swing</artifactId>
            <version>11</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-media</artifactId>
            <version>11</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-base</artifactId>
            <version>11</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-web</artifactId>
            <version>11</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-graphics</artifactId>
            <version>11</version>
        </dependency>
    </dependencies>

    <build>
        <!-- Non standard place -->
        <sourceDirectory>src</sourceDirectory>

        <!-- Non standard place, contains openjfx_OS_...-sdk.zip . TODO Check: Is this actually bundled and required? -->        
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>

        <plugins>
            <!-- Enforce a minimum maven version -->
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-enforcer-plugin</artifactId>
              <version>3.0.0-M2</version>
              <executions>
                <execution>
                  <id>enforce-maven</id>
                  <goals>
                    <goal>enforce</goal>
                  </goals>
                  <configuration>
                    <rules>
                      <requireMavenVersion>
                        <version>(3.5,)</version>
                      </requireMavenVersion>
                    </rules>
                  </configuration>
                </execution>
              </executions>
            </plugin>

            <!-- Copy the fxml files -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <id>copy-swf-files</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target name="copy fxml files to target">
                                <copy todir="${project.build.outputDirectory}">
                                    <fileset dir="${project.build.sourceDirectory}">
                                        <include name="**/*.fxml"/>
                                    </fileset>
                                </copy>
                            </target>
                        </configuration>
                    </execution> 
                </executions>
            </plugin>

            <!-- TODO Don't really need the dependencies in the jar just for building. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/classes/lib</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <release>11</release>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                  <includes>
                     <include>**/*</include>
                  </includes>
                  <archive>
                    <manifest>
                      <addClasspath>true</addClasspath>
                      <classpathPrefix>lib/</classpathPrefix>
                      <mainClass>me.goddragon.teaseai.Main</mainClass>
                    </manifest>
                  </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <id>default-cli</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>${java.home}/bin/java</executable>
                            <commandlineArgs>${runfx.args} test</commandlineArgs>
                            <arguments>
                                <argument>
                                    test
                                </argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

  • Run Maven build with "mvn clean package". The first run may take a while.
  • Start the newly build software: java -jar TeaseAi.jar
Some notes on the setup
  • We share the JavaFX with the parent directory and use these for running the software
  • The JavaFX jars are also downloaded for building (see the dependency section) which may be ok but it is also put into the Jar which blows it up. Still it works. Medium term risk for confusion of versions.
  • When starting the software checks for JavaFX. Then it re-launches itself and loads the JavaFX. For this to work the jar has to be named exactly as it is (or renamed via the symlink to the real jar in the target directory).
Debug and IDE setup

I can just see Java developers shiver when I now describe a setup where I use Visual Studio Code for development. Certainly IntelliJ (not free), NetBeans or Eclipse are more appropriate for Java development. I still like VSC especially as it does not come with a lot of pre-conceived ways of doing things or a lot of configuration state. I also believe that it's strengths on the JavaScript side are useful here for an end-to-end experience.

Download and install Visual Studio Code from https://code.visualstudio.com/Download

Install the following extensions:
  • GitLens
  • Maven for Java
  • Java Extension Pack (contains a number of relevant extensions)
Create the following .vscode/launch.json file:
Spoiler: show

Code: Select all

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "java",
            "name": "Debug me.goddragon.teaseai.Main (javafx passed)",
            "request": "launch",
            "mainClass": "me.goddragon.teaseai.Main",
            "projectName": "TeaseAi",
            "stopOnEntry": true,
            "sourcePaths": ["src"],
            "args": ["--module-path=./javafx-sdk-11/lib", "--add-modules=javafx.controls,javafx.fxml,javafx.base,javafx.media,javafx.graphics,javafx.swing,javafx.web", "test"],
        }
    ]
}
  • With "File->Open..." (not Open Workspace) select the DevDir and press "Open". You may get some prompt asking about the visibility of your .vscode directory, I suggest to keep it visible.
  • The software can now be debugged simply by going "Debug->Start debugging". You will get an error but you choose to proceed anyways. We are building the software not with VSC and don't care what VSC thinks here.
  • The VSC launch.json starts already the second phase of the bootstrapping process you are are now in a position to set breakpoints and examine the behavior of the software as you please :-) .
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 »

Great guide!
Zefram
Explorer
Explorer
Posts: 6
Joined: Sun Feb 03, 2019 11:27 am

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

Post by Zefram »

My JavaScript Development Setup

What I don't like about writing for TAJ is that it requires TAJ to run JavaScript code and the only way to debug the code is with some logging statements. I can neither debug nor automatically test the code. Or could I? The following is work in progress - use at your own risk.

The JavaScript in TAJ runs under the control of Java in the so called Nashorn engine. I've not found a way to attach any debugger to this embedded JavaScript engine yet. Anything I describe now is based on running TAJ JavaScript code standalone. The biggest remaining limitation is that the TAJ API to Java needs to be simulated. But that can be done for specific use cases and in a lot of cases the API calls to Java land can be cordoned off in selected modules that can be swapped out for testing.

The key challenge besides the API simulation I saw in running JS code outside TAJ is the lack of modules. All is in global scope in TAJ and different files are included with a "run()" command. Any non trivial testing and debugging would quickly involve several files and the run command needs to be faked. The standard JS mechanisms require() or the more modern import do not allow this. It took some digging but I think there is a way to have an equivalent run() command when running the code on Node :-)

Imagine creating a main.js like this

Code: Select all

var fs = require("fs");
var vm = require("vm");

// See: Chad Austin https://stackoverflow.com/questions/5797852/in-node-js-how-do-i-include-functions-from-my-other-files
function run(path) {
    var code = fs.readFileSync(path, 'utf-8');
    vm.runInThisContext(code);
}

run('./onefile.js');
run('./anotherfile.js');
functionFromOneFile();
Now you can run this file with "node --inspect-brk main.js" and the attach Chrome debugger to it. Back from medieval printing to debugging and testing in modern tooling land :yes: .

Notes:
  • Before starting to install node on your system if you have not yet please install "nvm". This allows you switching node versions in a less painful manner: https://medium.com/@itsromiljain/the-be ... 8a8544987a. You don't have to install yarn, modern npm is good enough. Note that there are subtle differences in nvm commands between Mac, Windows and Linux but the basic functionality is the same.
  • At the moment I use Node 10.x LTS but this is without thinking about it much. It may be worth thinking about JS compatibility with Nashorn and also about Babel and other tooling impact. Needs some experimenting.
  • On using the Chrome debugger in general: https://developers.google.com/web/tools ... avascript/
  • On using the Chrome debugger to attach to Node processes: https://medium.com/@paul_irish/debuggin ... 4a1b95ae27
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 »

Great guides. Really appreciate your detail and effort! However I guess your JavaScript setup runs without TAJ in the background so you will have no access to TAJ functions right? Or do you just run the script using TAJ and attach the debugger somehow?
enoch
Explorer
Explorer
Posts: 46
Joined: Wed Jan 24, 2007 8:31 am
Gender: Male
Sexual Orientation: Straight
I am a: Slave
Dom/me(s): Goddess Maya Loux
Contact:

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

Post by enoch »

GodDragon wrote: Fri Sep 07, 2018 12:59 pm
enoch wrote: Fri Sep 07, 2018 1:57 am Is there any interest in any of the following:
  • Integrations with other services / devices? (say lovense, pavlock, dreamlover labs; niche, I know...)
  • RCS/Git/hosting for this sort of project?
I probably don't have time to contribute to the main codebase, but I'm wondering if any of the above would be useful?

I have working microservices for lovense, pavlock, and dreamlover labs stuff.
Sure. I would love to integrate external devices into TAJ. Feel free to show/link me your projects.
What exactly do you mean with hosting?
Here are some fairly crude projects. They're mostly MVPs, not anything finished or polished.

http://tools.mayaloux.com/pressure/
Web-app meant to be accessed on a smart phone or touch screen. It measures how long a person has held down the big button. This can connect with lovense devices. When connected, it gradually increases the vibration intensity as long as the subject holds down the button. If they break contact it shuts the vibe off and starts over.

It has the option to send JSON status updates to an external URL, so some other webservice or something can be integrated with it. Personal use case was a arduino wired up to some magnetic door locks. Breaking contact would increase the time the locks would stay engaged.

http://tools.mayaloux.com/pressure/
Sort of a clone of "Fond of Writing" but with some added features.

http://tools.mayaloux.com/wTrack/wtrack.php
Kind of a weird "tool/game/webtease". It's better explained by just opening it and checking it out. It's basically a webtease sort of thing for when a sub "just has to touch themselves" but isn't supposed to without permission.

***
When I mentioned hosting, I was talking about a few possible things.

One, is it makes sense to have some kind of Git or other revision control system for the project source code. I don't believe github really allows adult content. However, I used to run a Github-like site for projects Github doesn't allow. I could probably set up something for you if needed.

I'm thinking a long the lines of Git for the main project, as well as user-created scripts. Making it easy to do things like fork a tease, work on one collaboratively, etc.

Two, if you need any kind of central web server or database backend online for the stuff you're doing, that's kind of my specialty.
enoch
Explorer
Explorer
Posts: 46
Joined: Wed Jan 24, 2007 8:31 am
Gender: Male
Sexual Orientation: Straight
I am a: Slave
Dom/me(s): Goddess Maya Loux
Contact:

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

Post by enoch »

Oh, just wanted to add for the wTrack and typing things above, you can just use a bullshit email address like "uyvtyvyv@localhost".
machine_maker
Explorer
Explorer
Posts: 18
Joined: Sat Apr 06, 2019 11:21 am
Gender: Male
Sexual Orientation: Straight
I am a: Submissive

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

Post by machine_maker »

So is there any way to set all images until whenever from the domme to have a specific tag without having to use showPicture() after every message? Basically let's say I wanted to keep the domme clothed until a specific point. How would I go about that? I couldn't find any methods for this. (maybe I'm just blind)
Post Reply

Who is online

Users browsing this forum: No registered users and 35 guests