skfunctions.lua

Started by SleepKiller, July 02, 2013, 06:31:21 AM

Previous topic - Next topic
July 02, 2013, 06:31:21 AM Last Edit: July 02, 2013, 06:52:28 AM by SleepKiller
Have you ever wanted access to lua functions written by SleepKiller for SWBF? No? Go look at cats then. if yes read on! In the attached .zip file you'll find my lua functions file. Just download then add these lines to your mission.req.
REQN
{
"script"
"skfunctions"
}


Then add this line to your mission script right below ScriptInit()
ScriptCB_DoFile("skfunctions")
Then your good to start calling the functions in your mission script! So what functions are there exactly?



ForceClasses -- For use with AddRandomClasses.
AddRandomClasses -- Randomizes a teams classes.
ForceShadowsOff -- Forces shadows off. (Legacy, use ForceVideoSettings instead.)
ForceVideoSettings -- Forces video settings based off arguments.
AddExpansionClasses -- Adds expansion pack classes.
GetPickedClasses -- Get's previously picked classes from a file.
LogProgress -- Log's a functions progress.

GetNumberFromFile -- Fetches a number from a text file.
DoesFileExist -- Tests to see if a file exists. Returns true if it does.
UseLateAddon -- TBR only function, you can always edit if you want.
GetLocatedNumber --Gets a number from a specific location in a file.
ReadStringFromFile --Almost exactly the same as GetNumberFromFile, except it returns a string value instead.


Now a lot of the stuff references to The Battle Royale's addon folder skmc2 and also expects there to be a sub-folder iofiles in there. To quickly be able to use them in your map just run a Find and Replace operation in something like Notepad++ for skmc2 and replace it with your world ID. Then in the same folder as addme.script create a folder called iofiles . You should then be good to go.

I may do a write up at some point on how to correctly use each function. For now just ask me how to use something or what something does and I'll explain.


Thanks for releasing these--I will investigate them some time.

Your hard work on them is appreciated.  :cheers:
Quote from: Abraham Lincoln. on November 04, 1971, 12:34:40 PM
Don't believe everything you read on the internet

Quote from: SleepKiller on July 02, 2013, 06:31:21 AM
ForceShadowsOff -- Forces shadows off. (Legacy, use ForceVideoSettings instead.)
ForceVideoSettings -- Forces video settings based off arguments.
Is this how console SWBFI gets specific video settings?

Very Very cool stuff here.

I've been anxious to play with randomizing things, but haven't given myself time to try anything out.

I may take a week and re-design my test world around this.

And it's commented. That helps a lot.

Good work, and thanks, SK.

Great work of course SK... I still remember when you came to me with this mad scheme and now look, you went and pulled it off.

Multiple HUZZAHS!

Quote from: Kit Fisto on July 02, 2013, 09:08:00 AM
Is this how console SWBFI gets specific video settings?
Nope. The consoles will be hardcoded with their video settings.

Quote from: tirpider on July 02, 2013, 01:32:16 PM
Very Very cool stuff here.

I've been anxious to play with randomizing things, but haven't given myself time to try anything out.

I may take a week and re-design my test world around this.

And it's commented. That helps a lot.

Good work, and thanks, SK.
Heh, I tried to keep it commented. Although with all the revisions to functions you may find random comments where code used to be.... Or some comment on some line that doesn't make sense. For the most part though it is. Like I said if you need help on how to use something or what some line of code is doing. Just ask and I'll be more than happy to explain.

I forgot to mention last night as well that I will be updating the file every so often when I create new functions. I'll post when/if that happens.

Always useful to have more options with the mission LUA. Thanks for sharing.