Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Lua ➜ How to create a database accessable from both mc and irc

How to create a database accessable from both mc and irc

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by ReallyCurious   USA  (50 posts)  Bio
Date Thu 26 Apr 2007 09:48 PM (UTC)
Message
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!
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 27 Apr 2007 12:25 AM (UTC)
Message
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.


  1. 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.

  2. 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.



- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


13,994 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.