[Reusable] Map Finish Command Execution Lua Script

This thread contains content that may be reused, modified, or ported by anyone.
The Map Finish Command Execution Lua script allows you to execute console commands when you finish the level.

Configs:
All the configs must be in the MFCE folder located inside of the SRB2 home folder. The MFCE setup config is executed on map change by the server, and does not support the prepareCommandsForClients command since it is only used to set certain server settings if you have this Lua script loaded that you would not want to be loaded otherwise. The file name for the MFCE setup config is mfce-setup.cfg Both the MFCE server and client configs are executed when a player finishes the level, but the MFCE server configs are server-sided, while the MFCE client configs are client-sided. The file names for the MFCE server configs are mfce-server-Cluster([local]serverClusterData.ID)-([global]gamemap)-Tag([global]player.mo.subsector.sector.tag).cfg, while the file names for the MFCE client configs are mfce-client-Cluster([local]serverClusterData.ID)-([global]gamemap)-Tag([global]player.mo.subsector.sector.tag).cfg.

Commands:
The prepareCommandsForClients command can take any number of commands, and only works if used inside of a MFCE server config, and it is used to execute commands on all clients. The setClusterData command is used to set the server cluster ID, and server cluster name, which are both strings, but it is recommended that the server cluster ID is all lowercase and has no spaces.

Changelog:
Map Finish Command Execution v1.1.1:
* The commands exitgame and quit can no longer be used as arguments for the prepareCommandsForClients command
* Final version for SRB2 2.1.25

Map Finish Command Execution v1.1.0:
* Rewrote the MFCE Lua script to support server side command execution on map finish
* Removed the executionmode
* Replaced the serverid with the setclusterdata command which sets both the id and name of the server cluster
* Added the showclusterdata command
* Removed the setcommandbuffer command
* Added the preparecommandsforclients command, which will only work if used inside of MFCE server configs
and this command is used to execute commands on all clients on a specific server cluster
that finish a specific level using a sector with a specific tag
* Added MFCE setup config, which is called mfce-setup.cfg and is executed on map change
* Added MFCE server configs, which are called mfce-server-Cluster([local]serverClusterData.ID)-([global]gamemap)-Tag([global]player.mo.subsector.sector.tag).cfg
* Changed the name of MFCE client configs to mfce-client-Cluster([local]serverClusterData.ID)-([global]gamemap)-Tag([global]player.mo.subsector.sector.tag).cfg

Map Finish Command Execution v1.0.0:
* Initial release

GIFs:
attachment.php
 

Attachments

  • srb20000.gif
    srb20000.gif
    1.6 MB · Views: 720
  • MFCE v1.1.1.zip
    3.4 KB · Views: 113
Last edited:

D00D64

Probably Responsible
Moderator
Judge
Welcome to releases! Though, it'd be best to have a GIF of your example in action, so we have a visual example of this happening too.
 
Welcome to releases! Though, it'd be best to have a GIF of your example in action, so we have a visual example of this happening too.
I'll do that after I release MFCE v1.1.0 since it is already almost complete. It only took less than a day to make MFCE v1.0.0 as well with how small MFCE is.

Edit: Due to real life stuff that I need to do and wanting to polish up the next update for MFCE, MFCE v1.1.0 won't come out until next week, and as a result, I'm going to take a GIF or too of MFCE v1.0.0 in action.
 
Last edited:
Sorry for the triple post, but with my extreme boredom and 2.2 coming out really soon, I've decided to change up MFCE v1.1.0 again while finally figuring out how to make the player number added by 1 unnecessary for server configs without breaking them and bug testing this Lua script again. As a result, MFCE v1.1.0 is no longer delayed and has been released, and MFCE Config Creator is officially, permanently canceled, but this may or may not be the last version of MFCE, which is currently unknown.

Edit: I re-uploaded the zip file, because I forgot to include the MFCE config folder, which contains the test MFCE configs.

Edit 2: I found a Lua error that occurs if you use the exitgame command as an argument in preparecommandsforclients, then try to use another argument after that particular argument. As a result, I'm going to have to fix this, and MFCE v1.1.1 is going to be the last version due to it being a nightmare to work with.

Edit 3: Change of plans since I came up with an idea that will actually work as a workaround for not being other able to join other servers after finishing the level effectively making MFCE useful for its intended purpose, which means that there will be a MFCE v1.2.0 for SRB2 2.2, and MFCE is not as big of a failure as I thought it was.
 
Last edited:

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Top