Re: [Tease AI Java] Developer's Guide and Help Thread
Posted: Sun Nov 25, 2018 7:42 pm
good catch. Just edited that.GodDragon wrote: Sun Nov 25, 2018 7:26 pmActually \ is used to escape the next character not /ski23 wrote: Sun Nov 25, 2018 6:53 pmSecond, 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)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.So I'm confident this part works. Because the sendMessage at the end produces the right path.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. }
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..This is my test file: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; } }
When it runs the showTaggedPic it produces the error: sendMessage("BUG: matchingImages was equal to null",4);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);
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![]()