Author Topic: Loading a print add-on manually  (Read 841 times)

    I've been put in the unfortunate position where, due to the fact that there's no regex support in gamemodes (or indeed any other form of mix-and-match search), I have to load every enabled brick and print pack in the gamemode itself.  For brick packs this is fairly trivial, but since print loading is handled automatically, I have no idea how I would go about handling it manually - or indeed if it's actually possible.


Is loading prints manually possible, or am I just going to have to not package RSM as a gamemode?

It is possible - but I do not know how to pull it off right now as I'm not on my computer. I can check tomorrow if noone posts a solution

I assume by gamemode you mean an actual gamemode.
Loading the prints is done automatically based on the enabled add-ons - after executing all of them.
That means you can just add the prints to the list of enabled add-ons in the server.cs of your gamemode, like this:

Code: [Select]
function enableAllPrints()
{
%pattern = "Add-Ons/Print_*.zip";
for(%file = findFirstFile(%pattern); isFile(%file); %file = findNextFile(%pattern))
$GameMode::AddOn[($GameMode::AddOnCount++) - 1] = getSubStr(%file, 8, strLen(%file) - 12);
}
enableAllPrints();

Then it would load all prints. So if you want to load only some of them, add code to do that etc

To actually manually load a print texture you would have to play with setPrintTexture and a load of variables at a specific time (as they get overwritten by the automatic load), I wouldn't try doing that
« Last Edit: March 16, 2014, 10:30:28 AM by Zeblote »


To actually manually load a print texture you would have to play with setPrintTexture and a load of variables at a specific time

I'm 100% sure I missed something here, but oh well.

To start loading a given ratio:

$printARStart["ratio"] = $globalPrintCount;
%localPrintCount = 0;


For every individual print:

$printNameTable["ratio/name"] = $globalPrintCount;
setPrintTexture($globalPrintCount, "Add-Ons/.../prints/name.png");
$globalPrintCount++;
%localPrintCount++;


To finish loading a ratio:

$printARNumPrints["ratio"] = %localPrintCount;
$printAREnd["ratio"] = $globalPrintCount;




loadPrintedBrickTexture("ratio") does this automatically for all enabled add-ons of the given ratio.
loadPrintedBrickTextures() calls the above for every discovered ratio in the Add-Ons folder.
« Last Edit: March 28, 2014, 05:54:19 AM by Port »