Rbtwrrr Scripter (Lachcim`s Scripting Mod revived) [Spaar`s Mod Loader] [Besiege 0.23]

#1
I was a user of Lachcim's scripting mod, which unfortunately seems to have gone un-maintained since the release of Besiege 0.2.

This is my revival of that mod, made with the help of a decompiler. This is also my first time working with both C# and Unity, so as you can imagine, although I did rewrite the code myself rather than just copy-pasting it, I haven't been particularly inventive. It was my aim to make sure scripts made for Lachcim's scripting mod would work with this (though modifications to any function definitions of onKeyDown and onKeyHeld will be necessary, as in the example script).

The "Usage" and "Documentation" sections of Lachcim's post are (mostly) valid for this mod. A simple example machine and script are included, "script-example.bsg", which will try to keep itself roughly upright. Press numpad 5 to make the machine fly up, and hold numpad 4 to nudge it to the left. These keys are implemented in the script, not the machine itself.

Here's a video of a somewhat more complex scripted machine:
The source code is also included.


Installation
  1. Requires spaar's Mod Loader, so install that first.
  2. Download RbtwrrrScripter.zip (below) and extract it into your Besiege_Data directory, merging the existing directories.

Getting keycodes

Open Mod Loader's console with CTRL+K and press any key while not simulating. It's numeric and textual ID will be logged in the console.


Getting block IDs

Open Mod Loader's console with CTRL+K and mouse-over any block on the machine while not simulating. It's ID, usable in lua, will be logged in the console. After adding any blocks to a machine, you must save (or otherwise reload) the machine in order to give the new blocks a valid ID.


License

Permission is granted to modify and redistribute the software, provided the source code is made available free of charge, the software is available free of charge, and the modification is made available under any compatible license.

Attached Files
RbtwrrrScripter.zip
 

ITR

l̺̤͈̘̰̺͉̳͉̖̝̱̻̠̦͈ͅ֍̫̜̥̭͖̱̟̟͉͙̜̰ͅl̺̤͈̘̰̺͉̳͉̖̝̱̻̠̦͈ͅ
Staff member
#2
The block-ID and keycode thing is really spammy, do you think you could add a toggle that deactivates it, or make it only activate if you're holding a key or something?
 

ITR

l̺̤͈̘̰̺͉̳͉̖̝̱̻̠̦͈ͅ֍̫̜̥̭͖̱̟̟͉͙̜̰ͅl̺̤͈̘̰̺͉̳͉̖̝̱̻̠̦͈ͅ
Staff member
#6
tubass said:
about the fire mod.cs inside the downloaded mod zip file. if i modified it does it alter the way this mod work?
No, you'd have to compile it and use the new dll
 

BCMM

New Member
#7
Sadly this seems to be broken with Besiege 0.25/Mod Loader 1.3.1. Prints an error every frame, and seems to keep re-executing scripts somehow.
 

BCMM

New Member
#8
tubass said:
uhm is there a way to get the distant between two blocks? that would be greate to make a hover machine :D
In case the mod gets fixed again: the distance between two blocks can be calculated from the coordinates of those blocks using Pythagoras's rule:

Code:
distance = math.sqrt((besiege.getPositionX(1) - besiege.getPositionX(2))^2 + ((besiege.getPositionY(1) - besiege.getPositionY(2))^2 + ((besiege.getPositionZ(1) - besiege.getPositionZ(2))^2)
Obviously, working out the distance in any single dimension (e.g. just the vertical distance) would be just a simple subtraction.
 
Top