im making a modloader to load things like plugins and mods in computercraft (mods have to be made for computercraft)
Here is my current code: (startup)
http://pastebin.com/xP7BYRZt
How to make a new mod:
Under mods, did you see modtest? Thats the base of making a new mod. (you can delete modtest)
To make a new mod, insert this code under mods:
function mod_NAMEHERE()
local getName = "NAMEHERE"
getMod1 = "mod_" ..getName
--code here
modcount = modcount +1
end
mod_NAMEHERE()
Understanding the code:
local getName = "NAMEHERE"
This lets the program know the name of the mod incase of a crash.
getMod1 = "mod_" ..getName
You don't need to change anything here, except for getMod1, Here you need to change the 1 to any number between 1-5. That number is the mod's ID and will crash if multiple mods have the same ID (didn't add a code to check if its conflicting yet)
modcount = modcount +1
Here, it adds 1 to mod counter. When the game crashes, this tells you how much mods there are.Currently, the mods can't really do much but print out stuff, but more stuff will be added later.
Current functions:
spamChatToggle = "on" -- turn on
spamChat = "" -- what it will spam
This will make a message appear on your screen forever until your BIOS crashes >
if getSentence == "" then
--code
end
getSentence detects what you typed. This will make it so it will do the execute the code inside of your mod when you type whatever is in the sentence.How to use the OS Maker (new):
newOSBoot = ""
This will change what you computer says when it turns on. If it is blank it will say:CraftOS (CRAFT OS VERSION) - Modded Edition
getOS = "CraftOS"
This is the name of the OS. It is shown inside the crash log.How to install mods:
If someone posts there mod's code/source, you can install it by pasting it under MODS.
Mod Examples:
function spammer()
local getName = "spammer" --insert mods name into the quotes
getMod1 = "mod_" ..getName -- change 1 to your mods ID, it has to be from 1-5 (no 0 or past 5)
spamChatToggle = "on"
spamChat = "spamspamspam"
modcount = modcount +1 -- this line is needed so modloader for computercraft can count your mods
end
spammer()
Spams your computer until it crashes
function ai()
local getName = "spammer" --insert mods name into the quotes
getMod1 = "mod_" ..getName -- change 1 to your mods ID, it has to be from 1-5 (no 0 or past 5)
if getSentence == "hi" then
print("Hi.")
end
modcount = modcount +1 -- this line is needed so modloader for computercraft can count your mods
end
spammer()
Makes your computer say hi when you say hi