In my guild irc channel a friend used to have a bot which would allow anyone in the channel to search for items in the database and the bot would spit out all matches with an appropriate # next to each item, and you could then get the 'ID' on that item by typing getitem # in the channel. Also, it was able to read items pasted into the irc channel, as well as items being 'ID'd' in game, and add it to the database, or update an old id with the new one.
I'd appreciate some pointers on how I can get started on this/what I should be thinking about/what I should be looking at.
Thanks!
Well, for safety and the ability to store large amounts of information, I would use a MySQL database. You can access one from MUSHclient using the mysql.dll as described here:
http://www.gammon.com.au/forum/?id=5983
A version suitable for MUSHclient 3.80 onwards can be obtained here:
http://www.gammon.com.au/files/mushclient/lua5.1_extras/mysql.zip
You may need this DLL too:
http://www.gammon.com.au/files/mushclient/lua5.1_extras/libmySQL.zip
From this point you have a couple of options.
- All your players can directly access the database, which means they would all query/update the database using the MySQL DLL from MUSHclient.
The disadvantage of this is that you would need to be careful that some unauthorized person did not also access the database. Also, those DLLs need to be installed for each player.
- You could make a "server" world (using MUSHclient), which does all the database access itself, and then sends/receives information to other players using the chat system. See:
http://www.gammon.com.au/mushclient/chat.htm
Using this you could make custom message types, so that (say) message 200 could query the database, message 201 could add a new item, and message 202 could update an existing item.
This is slightly more work as you have to write a "chat client" and "chat server" plugin, however I think it is more flexible, and the other players don't need to install any DLLs.
Plus, you could use chat validation to make sure that only authorized players are on the chat system, and thus using the database.
The basic way I imagine this would work is:
- Player Eraedus wants to get an ID on item 50. He types:
getitem 50
This is caught by an alias (matching "getitem *") which is in a plugin,
- That then generates a custom chat message:
Message: 200
Contents: 50
Send to: database_server (the server "player")
- The server plugin receives message 200 from Eraedus and looks up item 50 on the database (using SELECT ...).
- The server responds by sending a chat back to Eraedus:
Item 50 is the green broadsword of Pelivudd, damage = 10-20
Meanwhile you could also use the chat channel for general chatting as well.