Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - mctwist

Pages: [1] 2
Add-Ons / Fill Can v2
« on: March 02, 2019, 01:55:11 PM »
Disclaimer: Just want to make clear that this is a modification of an old add-on I do not own. All credits go to their respective owner. This add-on is released only because the old one was restricted to how many bricks it could paint before it hung the server. This update will only make it more stable by fixing this restriction.

Fill Can v2.0
From its predecessor, this tool will do everything that its previous version could do: Paint all near bricks that is the same color, to a different picked color. All other functionalities have not been touched at all. The update contains a more stable way to paint a ludicrous amount of bricks.

Technically all bricks next to each other, even on the edge, will be painted, as shown here. This animation also shows that after the gathering, it will only take one second to paint over 7k bricks.

Additionally I added so one can set the max bricks preference to 0 to remove the max brick limitation. Previously one needed to set a really high value to dodge this. (Keep in mind that it is not recommended to paint more than 5000 bricks anyway, which is the new default limit.)

Update: An another bug was fixed, which was fixed year ago, but actually was quite hard to find the topic for it. Mr.No▀ody provided with a fix for this issue, which was painting on players.

Update2: Max Bricks limit bug was fixed.

Thanks to Trinko for the suggestion and Misterlegodude for beta testing. Thanks to Mr.No▀ody for telling about an another fix for an another issue.

Technical jargon

The update includes a more stable way to locate the related bricks, and a much faster way to paint them and undo it. Keep in mind that this is not faster, but only made so it is much harder to hang the server in a case of what feels like eternal waiting period. Due to how it originally was intended, it is quite hard to make it faster than it currently is. Box searches are quite slow, and in worst case scenarios it has to look over 30 times more bricks than there actually are.

In comparison, in the alpha version of this update, it was made to work like the original. Note that the video above contains over 176k bricks which is painted in the course of about the same time as the original, but the video was cut down to make it shorter. That was changed in the beta, where it will now tell you it will gather all the bricks before it paints them, taking double the time but puts less strain on the server. While this is happening, removing the tool, dying or disconnecting from the server will stop the ongoing process. The beta version made it possible to undo this task in seconds on the same amount of bricks.

Also keep in mind that I took my time to make sure it looks like I didn't do anything to the source at all, as the code style is kept intact. That includes one(1) space indentation and no spaces anywhere where it normally should be spaces to make the code readable.


Download (

Old download:
Discord (My fix, but without fix of face paint)

Few requested for it, but no one wanted it that badly to even bother doing it. However, I came to the conclusion that if something is possible through JavaScript, it should be possible to do it trough TorqueScript, to some extent.

Therefore I searched and found a library that would do perfectly to be ported to TorqueScript. After a coupe of days I managed to finally make BigInt, the library that can handle any size of number thrown at it, and will calculate it within reasonable time.


Performance tests
All iterates 16,384 times each

Add with strings
500 + 150:       32ms  avg: 0.00195313ms
1500 + 2500:     64ms  avg: 0.00390625ms
100 digits:  28,416ms  avg: 1.73438ms
Add without strings
500 + 150:      896ms  avg: 0.0546875ms
1500 + 2500:  1,088ms  avg: 0.0664063ms
100 digits:   8,256ms  avg: 0.503906ms

Subtract with strings
500 - 150:       32ms  avg: 0.00195313ms
1500 - 2500:     64ms  avg: 0.00390625ms
100 digits:  44,960ms  avg: 2.74414ms
Subtract without strings
500 - 150:    1,024ms  avg: 0.0625ms
1500 - 2500:  1,280ms  avg: 0.078125ms
100 digits:   8,416ms  avg: 0.513672ms

Multiply with strings (last does 2,048)
500 * 150:       32ms  avg: 0.00195313ms
1500 * 2500:    288ms  avg: 0.0175781ms
100 digits:  68,704ms  avg: 33.5469ms
Multiply without strings (last does 2,048)
500 * 150:    1,760ms  avg: 0.107422ms
1500 * 2500:  3,296ms  avg: 0.201172ms
100 digits:  61,280ms  avg: 29.9219ms

Div with strings (last does 2,048)
500 / 150:       64ms  avg: 0.00390625ms
1500 / 2500:     64ms  avg: 0.00390625ms
100 digits:  12,480ms  avg: 6.09375ms
Div without strings (last does 2,048)
500 / 150:   44,416ms  avg: 2.71094ms
1500 / 2500: 34,112ms  avg: 2.08203ms
100 digits: 18,848ms avg: 9.20313ms

Compare it to an another library.

Current issues
Smaller calculation on objects is currently not done. This was a hard nut to crack, as checks needs to be done in such a way that it might hurt the performance. I've added the smaller variants of each operator, just need to stitch everything together.

Due to how TorqueScript works, arithmetic operators break integers for any value equal or bigger one million. It automatically transforms into a floating operator that makes it impossible to do calculations on.

Port made his own addition and subtraction and everyone was happy. However, I found myself in need of both multiplication and division. And why stop there and try to recreate the wheel when I found a rather quick unsigned integer addition made in JavaScript, so I ported it and then made my own version on the subtraction(Basically the same thing, but with recursion).

Unsigned Integer

I even put it to the test by adding it to sha256 with great results, up to 40% performance boost.

This issue is quite complicated, but I'll try to explain what I want to accomplish and what I've currently done as detailed as possible.

What I want to do
My Add-On EventScript currently uses findText on the client for GuiPopUpMenuCtrl to get the id for an event in a selection. However, this function is case-sensitive, which resulted in a suggestion to solve.

Therefore, I planned to override/package four functions that handled the registration of event names and NT names, giving me a lookup table for names, also indirectly giving me a case-insensitive way to get names.
Code: [Select]

What I have done
I found out that the last two was actually possible to override completely, replacing the existing functionality with one that is significantly faster.

The two first is an another story. I've checked through trace, but they are untraceable. I tried override, but they are not called by BL, but when I call them manually, they are called normally. When I package them, it's the same as override.

Here is a pastebin with what I've done so far: event_table.cs

Possible solutions
  • Package WrenchEventsDlg, so when opened it'll just generate the lookup table on the fly. This is worse performance-wise, as it means that it'll be called each time when opening the window instead of when the user joins the server.
  • Generate the table locally before going through the events to reduce the maximum lookup to a minimum. Could work, but as this script parsing is done in one run, it means that there could be a possibility of small lag when there is lots of events that needs to be parsed. Especially for output events.
  • Just don't do it. It's not worth the effort and are considered micro-optimization. It's not that big of a hit to the performance than one might thing, considering that everyone else is doing it. At worst, you'll have 60 lookups on a list of 60 events, which is only 3600 iterations in total.
  • Package GuiPopUpMenuCtrl::add and store the table list in there, ignoring the findText entirely. Two problems arise here: It will be added for all lists and therefore will be a really ugly way to add such thing; If the same value is added twice, then this wont work, but luckily it wont as events are limited that way anyway.

Anyone got a better solution?
Feel free to discuss better possible solutions, or maybe if you got an answer to how to fix this, as that would be the best optimization on all cases.

Add-Ons / [Support] EventScript - Sharing events for the future
« on: November 14, 2017, 03:42:33 PM »
For years people have used Duplicator or manual copying to transfer events from bricks and builds to other bricks and builds. Sharing events to others is also a hassle. Handling a huge amount of events have always become tedious and problematic. However, there is a solution for this.

This mod introduces the ability to script your events, through the new scripting language EventScript. It removes the hurdle of sharing. It reduces the problem with huge amounts of events. It completely obliterates copying issues.

Download. Install. Set your shortcuts of copy/paste/editor. Start scripting.

Copies the left code into the event system and then copies the event system into readable script.

After installing the add-on, go to Options to set the shortcuts for copying and pasting events. Keep in mind that anything that relates to ctrl+c, alt+c, ctrl+v and alt+v will not work as expected. When this is done, one could easily just join a server and go into eventing mode. While there, just copy the events with previously mentioned shortcut. This will place the script in the clipboard, ready to be pasted in any text editor of choice. If a script already is within the clipboard, it can be pasted in the same manner with the other shortcut.

Any errors will halt the script and let the user know, giving brief explanation of why it could not parse the script. Keep in mind that pasting will always overwrite your current events, unless an error occurs.

It is also possible to paste the script on the server, if the add-on is enabled.
Code: [Select]
$script = EventScriptServer_save(_myBrick);
EventScriptServer_load(_myBrick, $script);
First function saves the events to a string.
Second function loads the string onto the brick.

Key bindings
When no binding is set, these are the default:
Code: (Windows) [Select]
ctrl+shift+c  Copy
ctrl+shift+v  Paste
ctrl+shift+e  Editor
Code: (Mac) [Select]
cmd+shift+c   Copy
cmd+shift+v   Paste
cmd+shift+e   Editor

Script Example
Script provided by Platypi.
Code: [Select]
# Author: Platypi / SadBlobfish
# Makes a brick change colors on a loop when toggled

# Start color changing (start with events enabled)
start: [x][0]onActivate->Self->playSound("Beep_Checkout.wav")

# Stop color changing (start with events disabled)
[ ][0]onActivate->Self->playSound("Beep_Denied.wav")
end: [ ][0]onActivate->Self->cancelEvents

# Alternate between starting and stopping color changing

# Change colors
[x][0]onRelay->Self->setColor("0.898039 0.000000 0.000000 1.000000")
[x][500]onRelay->Self->setColor("0.898039 0.898039 0.000000 1.000000")
[x][1000]onRelay->Self->setColor("0.000000 0.498039 0.247059 1.000000")
[x][1500]onRelay->Self->setColor("0.200000 0.000000 0.800000 1.000000")

# Loop color changing

# Stop color changing when brick is blown up

More in Tutorial thread.

Official support
MEGA (Up to v1.6)

Known issues
An unknown amount of Add-Ons wont work correctly with this mod as they are modifying the Event window in an evil manner.
It is known that people have their own suggestion for design, but surely this standard is already set and cannot be altered.
I cannot take your babies. It would be against the law and I see it more of a burden than a gift.

Download (
Download (

Tutorial and Discussion

General Discussion / EventScript - Eventing 2.0
« on: November 14, 2017, 07:02:51 AM »

There has been several ways to handle events, even additions that add more functionality for it. Some even used it in ways that it was not supposed to. However, there was no specification or standard of how to write events outside of Blockland. Everyone went as they pleased and even if most people understood it, it was still tedious to implement the events if they were long enough.

Introducing the new scripting language EventScript. It standardizes the specification of how to write events through text.

Copies the left code into the event system and then copies the event system into readable script.

EventScript Support List
  • Standardized format for events, everything included
  • Optional semantics
  • Easy as copy-paste
  • Comments
  • Labels
  • Indexing and ranges

Code: [Select]
# Normal event
[x][33]onActivate->Self->fireRelayNum("1-5 5 7", "Brick")

# Disabled and delay with no params
[ ][500]onBlownUp->Player->Kill
[x][  0]onRelay->Self->fakeKillBrick("5 10 3.4", 2)

# Separate lines
"0.000000 0.000000 1.000000 1.000000"

# Default behavior
onRelay -> "test_brick" -> setColliding (1)
setApartment -> And -> setOwner (9845)
onProjectileHit -> Projectile -> Bounce (1.3)

# Indexes and ranges
onRelay -> Self -> toggleEvents([0:3])
onRelay -> Self -> toggleEvents([1,3,5])

# Labels
onRelay -> Self -> toggleEvents([myLabel:myLabel])

The language is built on being forgiving. All sort of whitespace is ignored and newlines are the only used as an exception for certain cases due to parsing issues. Below is a detailed walk-through of the first event in the example above.

Enabled / Delay
Code: [Select]
Each of these needs to be put between a pair of square brackets.
The first x is defining that the event is enabled. If there is no x, then it is disabled. Leaving this parameter out will default to enabled.
The second 33 is the delay. Leaving this out will default to 0 or server default.
These can be written in any order.

Code: [Select]
This defines the input event name. The arrow indicates the end of the name and the beginning of the target.

Target / Name
Code: [Select]
This indicates the current target. For named targets, one just put the name between double quotes. As for input event name, the arrow indicates the end of the name and the beginning of the output name.
Code: [Select]

Code: [Select]
The output name of the event.

Code: [Select]
("1-5 5 7", "Brick")
The parameters for the output event needs to be put between paranthesis. This is optional for output events with no parameters. Each parameters is separated with a comma. They could also be put between double quotes if it contain comma or double quotes. Recommendation is to put everything that isn't number between double quotes to avoid issues.

Indexes and ranges
Code: [Select]
Indexes or ranges is a feature to handle a bigger amount of event numbers. It supports both specific indexes and ranges from one number to inclusive an another number.
Code: [Select]

Code: [Select]
The above code creates a label that can be used to reference to the event after it.
Code: [Select]
These are then used for indexes and ranges so direct numbers are not needed.


The old Add-On makes comeback with enhanced performance. You pick the onRelays to fire. One relay to rule them all.

Code: [Select]
onActivate -> Self -> fireRelayNum ( "1", "Brick" )
onRelay -> Self -> setColor ( "blue" )
onRelay -> Self -> setColor ( "white" )

The brick will be colored blue. It is also possible to insert multiple numbers like:
Code: [Select]
1 5-7 9 11 15-17
The list is the direction of the event where Brick is the default current brick.

For fireRelayRandomNum, it will pick only one of the relays.

Code: [Select]
onActivate -> Self -> fireRelayRandomNum ( "1-2", "Brick" )
onRelay -> Self -> setColor ( "blue" )
onRelay -> Self -> setColor ( "white" )

The brick will randomly become blue or white.

Protip: Adding the same number more times in fireRelayRandomNum results in it being picked more frequently.

"If the event does not come to you, you come to it."

Download (
Download (


Code: (v5) [Select]
Improved performance significantly for bricks with lots of events but few targets.
Code: (v6) [Select]
Added fireRelayRandomNum
Fixed appended client
Removed redundant inputTarget
Code: (v7) [Select]
Fixed delay issue for fireRelayRandomNum
Performance and security improvements
Code: (v8) [Select]
Added support for Event_onRelay
Minor modifications
Code: (v8.1) [Select]
Added support for EventScript labels

General Discussion / Blockland Repository
« on: November 25, 2016, 11:31:23 AM »
Blockland Repository

There have been several attempts to create a place for this demanding community to manage Add-Ons created for Blockland. Most of them have ended up with an overcomplicated mod, a poorly designed website or non-dedicated moderators. Most of these projects eventually died, for one reason or another, leaving the user with nothing. I am dedicated to keeping this project of mine alive for as long as there is demand from the community. I present to you:

Blockland Repository
This is a work in progress. It may and will
change over time until base lines is satisfactory.

In its core, Blockland Repository is made with collaboration in mind. The stuff we do on this project will help you to distribute your created content to the user. It also makes it possible for you to share it with only those you want to share it with without having it displayed publicly. When you upload your Add-On, the server will scan through it for errors, problems and anything that could be noted and then tell you about this and then suggest a possible action for each issue. These actions could normally be that you ask the server to handle them for you.

This project is aimed only on the hosting part. The server hosting the project will only handle what it is asked for. If any mod wants a list of a specific Add-On, the server will hand it to it. If any other server wants to communicate with a server, they will happily share the information requested. The API implemented is based on Add-On Updater.

On top of this there is a few, but powerful, tools for moderation to handle Add-Ons. The system will mostly rely on the user to take action in deciding how good an add-on is. Either directly or indirectly.

There is a server up and running that should only be used to test. I can ensure the safety of your credentials, but I cannot ensure that everything uploaded there will still be there after each update. When we reach Beta, this may change. If you find a bug or something that fells off, please do tell me about it.

Current Status
It is currently in its Alpha stage. You can only register, login, upload an add-on and then browse and download it. It got more in the background, but that is way too much to go into in this single post. We do need more people that would like to try out something new. If you demand one functionality, I'm all ears for you to implement it if you are capable of doing so.

Future Plans
There's plenty of things that I want to add to this project. Therefore I made a tidy list that maybe explains everything of the main functionalities I want do add.
  • Add-On verification and modification
    • Script verification
  • Server-to-server Add-On sharing
  • Add-On content viewer
  • Save(bls) hosting
    • Add-On and colorset recommendation


Dev Logs
(At the ScatteredSpace forums.)

Add-Ons / Change Ownership - Give your bricks to someone else
« on: November 18, 2016, 02:13:18 PM »
Change Ownership
Can't wait for Christmas? Want to give a gift to a friend? Then build something and give the bricks to him so he can claim it as his. And then he destroys it.

This tool will make it easy to give your bricks to an another player. Just use the tool on a structure you own, then use it on the player you're giving it to. This can also be done the other way around. If the person is not around, you may even use the built in command to give the build to them manually. Keep in mind that you require at least Build trust between yourself and the one you're giving it to and you need to own the bricks you're giving.

If you're a Super Admin, then you can easily take over other builds, giving it to someone else or why not gift it to the host of the server.

If you know what the chown command in the unix system is and what it does, this does exactly that, hence the name on the tool.

Code: [Select]
/chown [bl_id/name]Skipping the argument results in getting the tool. With already the tool in your hand, you'll be presented with a quick help.

McTwist - Creator
Demian - Tester

Download (


Add-Ons / [Event] Apartment - Landlord like a boss
« on: July 10, 2016, 02:22:37 AM »
Ever wanted to rent an apartment without giving build rights? Found out that reloading a build made they loose their rights over their own bricks? Want to handle Ownerception(tm)?

This might be for you!

All you have to do is to follow this easy event example of how to set things up the right way:
Code: [Select]
setApartment -> And -> setOwner ( 0 )Even if you own the brick, now Badspot can easily build on that brick and still own the bricks after you load the save. This event structure needs to be set for each brick the renter will build upon.

Code: [Select]
fxDTSBrick::addApartmentOwner(%brick, %bl_id) - Adds a new owner to the brick
Known issues
It is possible to add several renters, but keep in mind that only the first one will keep the bricks when you load the save. This is a feature.
It is impossible to point to a brick with this, as that causes loading issues. It is always recommended to keep the number of baseplates to a minimum so less work has to be done.

Download (


Modification Help / Get bricks next to bricks [Solved]
« on: January 26, 2013, 05:14:17 PM »
This issue that I believe some of you have stumbled upon is about getting bricks that is in contact to other bricks. The problem is not to get the actual brick, but do it in such a fashionable way on the fly.

To get a brick above or under a brick, you would easily do so by using one of the following methods:
Code: (fxDTSBrick) [Select]
This will work flawlessly. Now, when it comes to getting bricks at the sides, there is currently no included functionality to do so, but can still be done by using one of these function pairs combined with the brick position and dimensions:
Code: [Select]
containerFindFirst / containerFindNext
initContainerBoxSearch / containerSearchNext
initClientBrickSearch / ClientBrickSearchNext
The last pair is only used locally on the client.

Even if these methods mentioned above works really great, the container has a flaw: It wont count in bricks that have their ray-casting off(Client version excluded). This is quite a big problem in my case, as I am in need to get all bricks, with or without ray-casting.
Badspot have implemented four events (fireRelayNorth/East/West/South) which all somehow works, even if ray-casting is disabled. Due to this, I suspect that he is using an internal system that negates ray-casting, or he knows some functionality we don't know. I wish for the latter.

A last resort could end up in looking through all bricks, or even better, a hash of closest brick clusters(Why not make a octree?), make some calculations and find the bricks that is next to the brick that is checked. It is however slow and wont be optimized for TorqueScript.

Even though, if anyone knows a solution of above problem, please enlighten me in that information.

Add-Ons / GUI Replacer
« on: September 20, 2010, 02:21:13 AM »

Got tired of the current GUI Hud? Don't want to replace them because you risk to loose the default one? Then this add-on is for you! You only have to download, run through the first install and you're ready for launch. The replacement is just one click away.
GUI Replacer consist of these features:
  • Replacement of GUI - Replace any GUI you would like without restarting the game. This provides a security that replaces and backups with ease. Don't mind how you'll do it, just press one button and watch the magic.
  • Backup of default GUI - Be safe with the GUI you already have, because it will backup it first things do, giving you the security of not loosing it.
  • Online services - Simply browse the current GUIs the API services provides. Check the screenshot over the GUI, download and use at once. You can also upload your own created GUI if you like, spreading it to the Blockland community.
  • Auto-Updater - No need to check when a new update has arrived. Just start Blockland and accept the update.

GUI Replacer Website


Pictures are old

Special thanks
Demian(10334) - Betatesting. Hosting site and some graphics.
Nasa62(5621) - Animated image.

GUI Replacer v1.5a

Put in your Add-Ons folder, normally located in "C:/Users/YourName/My Documents/Blockland". The first start will backup your current GUI and if it goes wrong, it tells you so.
This mod has only been tested in Windows. For best results, either run as an administrator or be sure that your Blockland folder is in a folder you have permission for.
For Mac, if RTB works for you this mod should as well. If it somehow does not work as you thought it would, either let me know here or re-install Blockland.

Known bugs
    There are no known bugs yet

Suggestions & Requests / MD5 and Array
« on: March 01, 2010, 01:17:36 PM »
(Moved from General Discussion)

I have two suggestions as the topic can tell, which I doubt will be added, but I'll give it a try.

First off, it would be good to have MD5 encryption included in the game, due it would be more secure to first encrypt the text, and then send it over to the server. Of course this would be best with for passwords.

Secondly, I think that some people miss how easy an array should be, so I found this Array object that could be really useful, not just for storing data, but also managing everything better rather than store it in simple arrays or strings.

If at least one of these could be added, I (and probably others) would be grateful.

General Discussion / Connection problem in v14
« on: February 24, 2010, 01:45:18 PM »
I don't know if this has been reported as a bug, and how many that get it. I think that this also have existed a while, but maybe there's a fix for it anyway. This happened more often after v14 release, and probably due the huge usage of the Master server when more than 150 servers is registered(Only a theory. No offense on the new awesome system.).
The bug is that the client suddenly freezes connection to the server by first lagging and then normally get stuck on 16 latency. The client can see everything that happens on the server and receive messages, but cannot send either messages nor commands, like when you walk or interact and such.
This fix I might have stumbled over was on a server, were one of the clients got stuck, and then the admin used demowand on him. Suddenly the client could continue like nothing have happened. This also works when the admin fetches the victim.
To conclude, what I believe that happen is that when the client lag, the server temporary lost the connection(/schedule) to the client, but when someone interact with the clients player, it updates the connection, and the client connection is back.
I(or any other random person) could make an add-on for this, were it checks the position of the player, and then reposition it a few millimeters up or such, forcing it to update the connection, until Badspot have fixed this. There could also be any other way doing it, so come with suggestions.

If anyone would like to confirm, disagree or come with ideas, please post.

Off Topic / "What a stupid name"
« on: October 27, 2009, 09:54:51 AM »
I just got on a server and the host started directly to talk to me about my mods. After 2 minutes, I got banned from the server by one of his Super Admins:

Oh, the irony...

Pages: [1] 2