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

API for getting names of installed mods

Started by Pharap, 06 February 2013 - 04:20 PM
Pharap #1
Posted 06 February 2013 - 05:20 PM
More of a question than a suggestion, but relevant to future CC versions nonetheless.

Would it at all be possible for computercraft to have an API that detects what mods are currently available in game?
i.e. a function that returns a table of strings that name all the mods in the mod folder/loaded into minecraft.

Main reason I ask is because I think it would be helpful for people writing programs designed to be compatible with different mods so they can test if the mod is available before trying to run the program or have a program behave differently if the user has certain mods available (i.e. if redpower for 1.4.6 isn't available, the program doesn't try to use bundled output at any point that would be illogical).
Dlcruz129 #2
Posted 06 February 2013 - 06:15 PM
It is certainly possible, but I don't really see merit to it.
Pharap #3
Posted 06 February 2013 - 06:22 PM
It is certainly possible, but I don't really see merit to it.
Well, if you want a program that adapts depending on available mods it would be useful.
Like there's the option to make a program run on non-colour computers as well as colour computers, but instead for if certain mods are available. For example if a program knows CCSensors are installed, it can check peripheral sides for a sensor or inform the user of any features it has regarding other mods.
Dlcruz129 #4
Posted 06 February 2013 - 06:26 PM
It is certainly possible, but I don't really see merit to it.
Well, if you want a program that adapts depending on available mods it would be useful.
Like there's the option to make a program run on non-colour computers as well as colour computers, but instead for if certain mods are available. For example if a program knows CCSensors are installed, it can check peripheral sides for a sensor or inform the user of any features it has regarding other mods.

print "Do you have redpower?"
input = read()
if input == "yes" then
  --rp2 stuff
end

Also, if you want to check for CCSensors, you can do:
if sensors then
  --sensor stuff 
end
immibis #5
Posted 06 February 2013 - 09:39 PM
It is certainly possible, but I don't really see merit to it.
Well, if you want a program that adapts depending on available mods it would be useful.
Like there's the option to make a program run on non-colour computers as well as colour computers, but instead for if certain mods are available. For example if a program knows CCSensors are installed, it can check peripheral sides for a sensor or inform the user of any features it has regarding other mods.
It can check peripheral sides for a sensor regardless of whether CCSensors is installed or not. Why would it handle "CCSensors isn't installed" differently from "CCSensors is installed but I don't have any attached sensors"?
ChunLing #6
Posted 06 February 2013 - 10:27 PM
Is this a feature you personally intend to use in a large project that would be useful across several different mods? If so, I still kinda think it would be easier to just code separate versions to work with each different mod arrangement, but can respect your desire for a way to make it run on any setup without needing user-input.

Still, I tend to feel that CC is more oriented towards people that would be capable of remembering which mods they have installed in a given world, even for those that maintain multiple builds to play different worlds. And, as I mentioned, I think that this functionality would be more hassle to use effectively than it would be worth just for saving effort on code. At the very least, it would trend towards bloated code distributions, which I personally don't like.
Cloudy #7
Posted 07 February 2013 - 12:09 AM
Hell no. How would you interact with the other mods without a peripheral anyway - apart from redstone which will activate regardless.
Sebra #8
Posted 07 February 2013 - 03:03 AM
There is another way of interaction:
If your Turtle will try to craft Iron chest and fails, chances are Iron Chest mod is not installed.
But seriously, what are you want it for?
Exerro #9
Posted 07 February 2013 - 05:43 AM
It might be useful for someone to create a program that has tutorials for different mods but will only display necessary mod tutorials, and if it's easy to do then why not? It could open up new unknown possibilities :P/>
Cloudy #10
Posted 07 February 2013 - 10:07 AM
No, it doesn't make any sense. Plus it breaks the fourth wall.
lieudusty #11
Posted 07 February 2013 - 05:23 PM
Doesn't make much sense to see what mods are currently installed.