Block Replacer 1.0.1 - Script by BigBang1112

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

User avatar
BigBang1112
Posts: 389
Joined: 20 Jul 2015, 12:44
Location: Czech Republic
Contact:

Block Replacer 1.0.1 - Script by BigBang1112

Post 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
Last edited by BigBang1112 on 22 Dec 2015, 22:59, edited 8 times in total.
Creator and competent racer. YouTube Discord
- ENVIMIX (out in open-source)
- Challenge (OUT NOW)
- Leaderboards (OUT NOW)
- Compute Shadows
User avatar
adamkooo2
Posts: 1371
Joined: 13 Jun 2014, 08:43
Location: Slovakia
Contact:

Re: Block Replacer 1.0 - Script by BigBang1112

Post by adamkooo2 »

nice job !

and does it work for objects too ?
because I need it ;)
Last edited by adamkooo2 on 21 Dec 2015, 15:36, edited 1 time in total.
/\rkady
Image
User avatar
BigBang1112
Posts: 389
Joined: 20 Jul 2015, 12:44
Location: Czech Republic
Contact:

Re: Block Replacer 1.0 - Script by BigBang1112

Post 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.
Creator and competent racer. YouTube Discord
- ENVIMIX (out in open-source)
- Challenge (OUT NOW)
- Leaderboards (OUT NOW)
- Compute Shadows
User avatar
adamkooo2
Posts: 1371
Joined: 13 Jun 2014, 08:43
Location: Slovakia
Contact:

Re: Block Replacer 1.0 - Script by BigBang1112

Post by adamkooo2 »

I'm really looking forwad on it ;)
/\rkady
Image
User avatar
TMarc
Posts: 15441
Joined: 05 Apr 2011, 19:10
Location: Europe
Contact:

Re: Block Replacer 1.0 - Script by BigBang1112

Post 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. :)
User avatar
adamkooo2
Posts: 1371
Joined: 13 Jun 2014, 08:43
Location: Slovakia
Contact:

Re: Block Replacer 1.1 - Script by BigBang1112

Post by adamkooo2 »

thank, you, you did it :thumbsup:
/\rkady
Image
User avatar
BigBang1112
Posts: 389
Joined: 20 Jul 2015, 12:44
Location: Czech Republic
Contact:

Re: Block Replacer 1.0 - Script by BigBang1112

Post 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.
Creator and competent racer. YouTube Discord
- ENVIMIX (out in open-source)
- Challenge (OUT NOW)
- Leaderboards (OUT NOW)
- Compute Shadows
reaby
Posts: 1032
Joined: 29 Dec 2010, 23:26
Location: Eastern Finland
Contact:

Re: Block Replacer 1.0 - Script by BigBang1112

Post 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);
reaby
Posts: 1032
Joined: 29 Dec 2010, 23:26
Location: Eastern Finland
Contact:

Re: Block Replacer 1.0 - Script by BigBang1112

Post 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 :)
reaby
Posts: 1032
Joined: 29 Dec 2010, 23:26
Location: Eastern Finland
Contact:

Re: Block Replacer 1.0 - Script by BigBang1112

Post 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;
}
Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 1 guest