Will look into this feature. I will give you more possibilities to do that because it sounds like something that makes sense to implement.ski23 wrote: ↑Fri May 18, 2018 6:50 pm For porting wicked tease, the one thing right now that is the highest priority for me is to have a way to like specific images from the teaseImages. In original TeaseAI, I believe the liked images were put into a file. If you could add this, or if you could add the way to open a picture given the url, I could implement it on the personality side of things.
One request I have that is a bit more complicated is the following. Could you add, or is there maybe support already that I haven't found, a way to display graphics on the screen. What I mean is a way to add support for games. For example, I'd like to eventually implement the RiskyPick game that is included in WickedTease (Deal or No Deal). I know this is probably a bit more complex than other things so if you don't want to, or if it will be a while until this is added, I understand.
Again, thanks for being so active and responding and helping me!
I won't add support on my end however you can just access everything from the javascript and do anything you'd like to regarding a gui. Check this out for starters: https://docs.oracle.com/javase/8/docs/t ... avafx.html
Same basicly goes for your first request. You could hook into my java implementation and show your custom images. However I will also add a dedicated function for that in the future.
Note: The current build hasn't fixed the metronome yet. I fixed it in the next build.
How can I call functions from a different Javascript file, in main.js?SkyHill wrote: ↑Fri May 18, 2018 11:41 pm This is really good so far, especially considering it's early on. I like how it's using straight up JavaScript so I don't need to figure out some custom language and the documentation is comprehensive enough that I have been able to do quite a bit with it after an hour or two.
Questions:
Issues:
- How can I call functions from a different Javascript file, in main.js?
- How do you get a string from the answer?
- What can you do with setVar/getVar, that you can't do with a regular variable (var test = 123)?
- What are the benefits of using the Edge methods, over a variable?
- Are the file and about buttons supposed to work?
- When clicking the Stop button while the dom is typing or after a sendInput event, it gets greyed out and only allows you to start again once you have typed something. When you do it after a createInput event, then there's no way to start it again.
- The image is not cleared when stopped.
- Under Method Documentation, Chat is linked twice.
Javascript does work a bit different here than OOP languages. If you run a file, you'll have that files methods available to you at any time. For example like this:
Code: Select all
run("Utils/RandomUtils.js");
This will run the file RandomUtils.js which looks like this. Note how this file has no code other than the code inside the functions. When running this file NO code will be executed.
However AFTERWARDS you can call the functions randomInteger(...), random(...) and isChance(..) from any file and anywhere. It doesn't matter what file or context as long as the RandomUtils.js file was run once before. Mind that you cannot specify what method to call from what file which means after there was another file executed that contained a function called randomInteger too it will overwrite the old one and the new one will be called everytime you call randomInteger(...).
Same goes for variables. If a variable is a "let" or a "const" and is outside of any code block it will be accessable from everywhere, however it will throw an error if you try to reassign a const variable and it will always throw an error if you are trying to redeclare a variable. Take a look here for example. I can access all these const variables from anywhere once this file was run once.
However NEVER run it twice or declare a variable that has the same name somewhere else because that will throw an error. If you have a file that you want to run multiple times but you want to declare variables outside of any if block, loop or function you can just wrap that part of the code in { } too. For example like in this file. Note how the first line is a { that is afterwards closed in line 121. This causes all variable declarations in this file to be limited to that code block only and they will neither collide with other files nor will they cause errors when running the same file twice. Still when running the file the whole code from line 1 to 121 is immediately executed. Which means: ANY variable outside of any parentheses should be considered a STATIC one. I know this doesn't really apply when writing var or nothing in front of it but you should work with const and let anyway because var is deprecated.
How do you get a string from the answer?
Code: Select all
answer.getAnswer();
What can you do with setVar/getVar, that you can't do with a regular variable (var test = 123)?
Those variables will stick around through sessions unless you set them to temporary while normal javascripts variables are deleted after every session and only stored in RAM (same for temp variables).
What are the benefits of using the Edge methods, over a variable?
None. You can create your own system.
Are the file and about buttons supposed to work?
No. Will in the future though.
When clicking the Stop button while the dom...
Hard to change that because I can't check it during normal script events whether the stop buttom was pressed. I can only do it when a function is called that will then check whether the button was pressed and then will stop everything. That is why it waits for someone to type. Hard to explain what is going on in the background however you can check out the source.
The image is not cleared when stopped
Fixed.
Under Method Documentation, Chat is linked twice
Fixed.
Regarding your issue with the path of the file: Just use / instead of \. \ always escapes the next character which means you'll need \\ to get it working in that case or just one /. It will adjust both slashes to the one used by your system internally anyway.SkyHill wrote: ↑Sat May 19, 2018 12:25 am Thanks for the reply!
How can I call functions from a different js file in main.js?
Ah, I never checked out the faq, so I missed that part. Though I don't know how to get the run command to work. In my personalities folder I added: Modules > Tease > test.js (sendMessage("You just ran test.js");) and in main.js I added: run("Modules\Tease\test.js");. But nothing happens so I'm guessing I'm doing something wrong.
How do you get a string from the answer?
One reason would be to have the dom repeat something you said before. Also, the getInteger method does not work for a string like: "I'm 22 years old". So I'd like to take the answer string and use it with a custom parse method.
What can you do with setVar, getVar that u cant with normal vars?
Ah, so they're like static variables in the sense that any code can access them and and there can only be one across all your code, as well as acting like a cookie. That's really useful. Most of my experience with programming comes from Actionscript 2.0/3.0 for Flash and Csharp for Unity so I'm more familiar with class based programming.
Oh yea, you could compare it to a cookie in a browser ;)