Automatron (1.1.7) [Besiege v0.45] [spaar's Mod Loader] [ID 410]

#21
I might be an idiot, but I can't get the Press Key function to work.
I'm getting this message: Warning: Could not start key simulator. Make sure it and java are installed correctly. Further information is printed in the console.
I reinstalled java and i made sure all the mod files are in the right place, but the problem remains... Do I need a different version of java or something? If I do, can I get a link?

The console shows this:

>Win32Exception: ApplicationName='javaw', CommandLine='-jar "D:/SteamLibrary/steamapps/common/Besiege/Besiege_Data/Mods/KeySimulator.jar"', CurrentDirectory=''
 

spaar

Active Member
#22
krowanek said:
I have a quersion, is it possible to use buttons like right ctrl, right shift, or numpad keys when using "press key" action?
Yes. All the special keys that are currently available are listed in the documentation for the Press Key action. Among them are shift, control and the numpad number keys.


thebesieginator said:
I might be an idiot, but I can't get the Press Key function to work.
I'm getting this message: Warning: Could not start key simulator. Make sure it and java are installed correctly. Further information is printed in the console.
I reinstalled java and i made sure all the mod files are in the right place, but the problem remains... Do I need a different version of java or something? If I do, can I get a link?

The console shows this:

>Win32Exception: ApplicationName='javaw', CommandLine='-jar "D:/SteamLibrary/steamapps/common/Besiege/Besiege_Data/Mods/KeySimulator.jar"', CurrentDirectory=''
I'm not sure why it wouldn't work if you have Java installed. Can you try opening a cmd window (press Windows+R, then type "cmd") and type "java -version" (without quotes) in there and tell me what it outputs?
 
#23
I've figured out a way to do self-centring steering hinges, though it needs four automatrons per hinge. This has enabled me to make a 16-automatron rocket-propelled aircraft. Still a work in progress, but it shows promise: :D





Building this made me think of another useful option: would it be possible to add a facility to link automatons to more than one block? This would avoid having to duplicate the automatons for the two aileron hinges.

(Rockets seem to be fine for propulsion by the way - you just need to increase the thrust and duration using the No Bounds mod)
 
#24
spaar said:
I'm not sure why it wouldn't work if you have Java installed. Can you try opening a cmd window (press Windows+R, then type "cmd") and type "java -version" (without quotes) in there and tell me what it outputs?

The output I got is:
java version "1.8.0_77"
Java <TM> SE Runtime Environment <Build 1.8.0_77-b03>
Java HotSot<TM> Client VM <build 25.77-b03, mixed mode, sharing>
 
#25
spaar said:
Yes. All the special keys that are currently available are listed in the documentation for the Press Key action. Among them are shift, control and the numpad number keys.
Oh, I somehow missed that part. Should read more catefuly :p Thx for replay :)
 

spaar

Active Member
#27
AJW said:
Building this made me think of another useful option: would it be possible to add a facility to link automatons to more than one block? This would avoid having to duplicate the automatons for the two aileron hinges.
I'm not quite sure what you mean. You can definitely control more than one block with one Automatron. Each action is currently limited to modifying one block, but you can just add an action for each block that you want do modify in some way. I might consider adding a possibility to let one action apply to multiple blocks.


thebesieginator said:
The output I got is:
java version "1.8.0_77"
Java <TM> SE Runtime Environment <Build 1.8.0_77-b03>
Java HotSot<TM> Client VM <build 25.77-b03, mixed mode, sharing>
That's weird, that means it should totally work... Can you upload your whole output_log.txt file from the Besiege_Data\ directory?


netsuad said:
Just tried to downloaded it but its not showing up in game, I have other blocks installed so ik block loaders working
Are you sure you extracted it correctly? You can check by making sure there's an Automatron.dll file and a KeySimulator.jar file in the Mods directory. If those are there and it still doesn't work, can you upload your output_log.txt file from the Besiege_Data\ directory please?
 
#28
Doh! You're quite right, there is nothing to stop me adding another action to the same automatron, I've no idea why I though it would need another one.
 
#29
spaar said:
That's weird, that means it should totally work... Can you upload your whole output_log.txt file from the Besiege_Data\ directory?
Here's my output log. I just realized that my java installation is on a separate partition of my HDD than my steam library. Would that possibly be affecting it?


output_log.txt


Attached Files
 
#30
spaar said:
That's weird, that means it should totally work... Can you upload your whole output_log.txt file from the Besiege_Data\ directory?
Here's my output log. I just realized that my java installation is on a separate partition of my HDD than my steam library. Would that possibly be affecting it?


output_log.txt



Attached Files
 
#31
Hi,

first of all nice mod we're finally going in the right direction here I would say! I see the gmod days pointing at the horizon somehow :).


Just had to let you know about a little thing I noticed. I actually tried making a key-mapping mod basically like your java KeySimulator here but rather in C# using User32 libraries. I could get that working in a Windows application and got pretty confident it would work up to the point I realized it would only crash the game in a brutal way with no warning or message whatsoever. I'm saying this because I tried it a few times in a row and than noticed my CPU started to not respond well. Opened the task manager and there I had one javaw instance running and consuming 10-20% CPU for each attempt I made.

Prior to this and purely out of curiosity I had checked your java code and those while(true) really got me scared. Also the fact that whenever any exception happens it simply restarts the whole thing no matter what state things are in (corrupt memory, etc...). Now I don't know how that java program can affect the game itself and it seems to remain pretty low risk in general but in my case it was quite problematic. It could happen to non-modders who just happened to test mods that are not compatible together and would crash their game. They would still have all those javaw instances running and sucking up their CPU resources without knowing what's happening.

Anyways I think maybe you should have some fail-safe with either a big idle timeout or (if possible, I don't know about that here) check if the host program (Besiege) is still running and shut down if not. Also again I don't do java so I don't know but I suppose you should be able to add some delays in your ""infinite"" loops. Otherwise I believe they could still badly alter the performance on computers with fewer CPUs (since it is using a different process than the game itself).

By the way (totally out of context but while I'm at it ^^) could you give us a public method in "ModConsole" that allows us to manually serialize the "output_log.txt" log file at any time ? If there is already one could you please let me know what it is ? I tried logging to the console at different times before the game crashed on me with my key mapping solution but of course it crashed before you serialize the file and so my debug messages were not in it ^^.


Well thanks for reading if you do. I know I write a lot when I start. Keep up the good work anyways. Cuz you're mostly the one reason I'm still paying attention to this game today.

Cheers
 
#32
Hello spaar,

really great mod but it would be cool if I could set press down key or another arrow key because it cannot recognize it now.

Hope it is possible...

 

spaar

Active Member
#33
GregBlast said:
Prior to this and purely out of curiosity I had checked your java code and those while(true) really got me scared. Also the fact that whenever any exception happens it simply restarts the whole thing no matter what state things are in (corrupt memory, etc...). Now I don't know how that java program can affect the game itself and it seems to remain pretty low risk in general but in my case it was quite problematic. It could happen to non-modders who just happened to test mods that are not compatible together and would crash their game. They would still have all those javaw instances running and sucking up their CPU resources without knowing what's happening.

Anyways I think maybe you should have some fail-safe with either a big idle timeout or (if possible, I don't know about that here) check if the host program (Besiege) is still running and shut down if not. Also again I don't do java so I don't know but I suppose you should be able to add some delays in your ""infinite"" loops. Otherwise I believe they could still badly alter the performance on computers with fewer CPUs (since it is using a different process than the game itself).
I think I mostly fixed the high CPU usage of the key simulator process in one of the updates, although it's possible I didn't completely eliminate it. I'm not really concerned about just restarting the loop in case of an error. In Java, it's almost impossible to really corrupt memory or something like that, the worst thing that could happen is that the same error happens again every time, which would just mean the process crashes with a StackOverflowException after a bit. Nevertheless, you're right that error handling with that could be improved. I didn't think too much of the case when Besiege crashes completely without the mod getting a chance to stop the simulator process, because it rarely ever happens for me, but the idea of a timeout or check if the process still runs is a good one. I'll improve this in the future.

GregBlast said:
By the way (totally out of context but while I'm at it ^^) could you give us a public method in "ModConsole" that allows us to manually serialize the "output_log.txt" log file at any time ? If there is already one could you please let me know what it is ? I tried logging to the console at different times before the game crashed on me with my key mapping solution but of course it crashed before you serialize the file and so my debug messages were not in it ^^.
I'm not sure whether I can force serialization of output_log.txt since that file is handled by Unity, but in the developer build the console also writes to Mods/Debug/ConsoleOutput.txt. I will add a method to ModConsole to force writing that in the next mod loader update.


Mod User said:
Hello spaar,

really great mod but it would be cool if I could set press down key or another arrow key because it cannot recognize it now.

Hope it is possible...
It is already possible, the same list I already mentioned to krowanek above also contains "up arrow", "down arrow", "left arrow" and "right arrow" as special keys. You can enter those just like that, without the quotes.

thebesieginator said:
Here's my output log. I just realized that my java installation is on a separate partition of my HDD than my steam library. Would that possibly be affecting it?


output_log.txt
It shouldn't affect it, no. I'm still not quite sure what's going on, but I have a plan for how we can hopefully find out. I'll make a version of the mod with some more debug output that should hopefully help diagnose what's going on. When it's ready, I'll post it here for you to try out.
 

spaar

Active Member
#38
thebesieginator Can you try it using the version attached to this post? If it still doesn't work, there should be some additional information in the error message, so post that here again.

Edit: Whoops, forgot to actually attach anything... Fixed that

Attached Files
Automatron.dll
 
Top