This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
ComputerCraftFan11's profile picture

ModLoaderCC [API]

Started by ComputerCraftFan11, 04 March 2012 - 02:51 AM
ComputerCraftFan11 #1
Posted 04 March 2012 - 03:51 AM
ModLoader For ComputerCraft 1.3

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
ComputerCraftFan11 #2
Posted 04 March 2012 - 04:20 AM
New function: getSentence
ComputerCraftFan11 #3
Posted 04 March 2012 - 04:27 AM
*fixed Boot message not appearing until you chat
*fixed getSentence not working
ComputerCraftFan11 #4
Posted 04 March 2012 - 05:24 AM
New Mod:

function modlist()
local getName = "ModLister" --insert mods name into the quotes
getMod4 = "mod_" ..getName -- change 1 to your mods ID, it has to be from 1-5 (no 0 or past 5)
if getSentence == "mods" then
  term.clear()
  term.setCursorPos(1,1)
 
  print("Mods loaded: " ..modcount.. ".")

  if getMod1 == "" then

  else
   print("" ..getMod1)
  end

  if getMod2 == "" then

  else
   print("" ..getMod2)
  end

  if getMod3 == "" then

  else
   print("" ..getMod3)
  end

  if getMod4 == "" then

  else
   print("" ..getMod4)
  end

  if getMod5 == "" then

  else
   print("" ..getMod5)
  end
end
modcount = modcount +1 -- this line is needed so modloader for computercraft can count your mods
end
modlist()

This lists all the mods you installed when you say "mods"
ComputerCraftFan11 #5
Posted 04 March 2012 - 05:30 AM
*Updated Crash Log
ComputerCraftFan11 #6
Posted 04 March 2012 - 05:45 AM
New Mod:

function mod_BootUp()
   local getName = "BootUp"
   getMod5 = "mod_" ..getName
   newOSBoot = "Welcome!"
   modcount = modcount +1
end
mod_BootUp()
Says Welcome! when you turn on the computer.
ComputerCraftFan11 #7
Posted 04 March 2012 - 05:52 AM
NEW:
OS Maker!
ComputerCraftFan11 #8
Posted 04 March 2012 - 06:20 AM
Fixed getSentence and the "> _" not appearing until you press enter.
FuzzyPurp #9
Posted 04 March 2012 - 06:30 AM
Dude edit your own quotes, stop spamming your own thread for every single change you make.
remlly #10
Posted 04 March 2012 - 11:48 AM
sounds cool, but waht do you mean with modloader, is it like mdoloader for minecraft, or does it something else
bonnis #11
Posted 04 March 2012 - 12:08 PM
it mods in a mod! MODCEPTION!!
really, computercraft is really an modception+mineception+computerception
3 ception in one mod!
Cloudy #12
Posted 04 March 2012 - 07:47 PM
Would you mind explaining what advantages this has over any other solution? I'm struggling to find the point of this.