Page 1 of 2

Block Replacer 1.0.1 - Script by BigBang1112

Posted: 21 Dec 2015, 14:23
by BigBang1112
Block Replacer 1.0.1
Hello there! So, after a lot of maniascript learning, I've finally finished my first useful plugin. :thumbsup:

Image
The UI of the plugin.

The script let you replace all specific blocks with other block of your choice.
It's simple, pick a block to your cursor and click on the first Pick button. This will set the variable to be this block. Then select a block to be replaced and click on the second Pick button. And click on the Replace button to do the action.


Download here | Video

Installation:
  1. Put the downloaded text file into Documents\ManiaPlanet\Scripts\EditorPlugins\TrackMania (or ShootMania)
  2. Run the script in the editor
  3. Done
Changelog:
  • 1.0.1 - Fixed direction bug (special thanks to reaby)
Features:
  • Very quick action, replace doesn't took even second to do. (but that depends on your computer)
  • Picking system, very efficient once you'll get it.
  • Smooth Manialink design, doesn't fill much in the editor or hurt to the eyes.
  • It replaces most of the properties of the block.
  • It works for all ManiaPlanet titles
Known bugs:
  • Replacing road blocks does not work properly
Future:
  • Undo button
Suggestions (2.0):
  • Replace small objects - adamkooo2
Enjoy! Mabye this thing will help you someday. Download now! :D

Re: Block Replacer 1.0 - Script by BigBang1112

Posted: 21 Dec 2015, 15:26
by adamkooo2
nice job !

and does it work for objects too ?
because I need it ;)

Re: Block Replacer 1.0 - Script by BigBang1112

Posted: 21 Dec 2015, 15:31
by BigBang1112
adamkooo2 wrote:nice job !

and does it work objects ?
because I need it ;)
Thank you! :P
Objects? Yoi I didn't even think of that. :D Well, sadly it doesn't, because the script is only working with normal blocks (so also terrain is not working).
Hm that might be a next goal to Block Replacer 2 then :P Nice idea.

Re: Block Replacer 1.0 - Script by BigBang1112

Posted: 21 Dec 2015, 15:39
by adamkooo2
I'm really looking forwad on it ;)

Re: Block Replacer 1.0 - Script by BigBang1112

Posted: 21 Dec 2015, 19:51
by TMarc
Nice work :3 :thumbsup:

Aside from the "replace all road blocks issue", you could automatically put the new block that is used to replace blocks as new block to be replaced. :)

Re: Block Replacer 1.1 - Script by BigBang1112

Posted: 21 Dec 2015, 19:54
by adamkooo2
thank, you, you did it :thumbsup:

Re: Block Replacer 1.0 - Script by BigBang1112

Posted: 21 Dec 2015, 22:17
by BigBang1112
Thank you all there. :D
The undo is simple do as it's even included, u just need to do it right (and don't replace the road, that will mess everything).
The main problem is with the north replacement of the blocks. I just cant read blockFound.Direction somehow to place the block and I'm coming out of ideas. Any help about this? I don't understand enums still in MS.

Re: Block Replacer 1.0 - Script by BigBang1112

Posted: 21 Dec 2015, 23:31
by reaby
If i'm correct, it should be as simple as this.

try @line 39:

Code: Select all

PlaceBlock(GetBlockModelFromName(NewBlock), <x,y,z>, blockFound.Direction);

Re: Block Replacer 1.0 - Script by BigBang1112

Posted: 21 Dec 2015, 23:37
by reaby
Ah, I see now. The problem is that the CardinalDirections differs from block to CEditorPlugin... give me few minutes to figure out the casting :)

Re: Block Replacer 1.0 - Script by BigBang1112

Posted: 21 Dec 2015, 23:43
by reaby
OK...
So this should do it.. i tested it now and it works other parts but not with normal road for a reason.
I guess it's that you have to connect the normal road with more than 1 replacement block... ie you have to have direction for the road ?

@line 39:

Code: Select all

PlaceBlock(GetBlockModelFromName(NewBlock), <x,y,z>, castDirection(blockFound.Direction));
and the helper function goes like this:

Code: Select all

CEditorPlugin::CardinalDirections castDirection(CBlock::CardinalDirections dir) {
	switch (dir) {
		case CBlock::CardinalDirections::North:
			return CEditorPlugin::CardinalDirections::North;
		case CBlock::CardinalDirections::East:
			return CEditorPlugin::CardinalDirections::East;
		case CBlock::CardinalDirections::South:
			return CEditorPlugin::CardinalDirections::South;
		case CBlock::CardinalDirections::West:
			return CEditorPlugin::CardinalDirections::West;				
	}
	return CEditorPlugin::CardinalDirections::North;
}