[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  How to create a database accessable from both mc and irc
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

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] Refresh page


Posted by ReallyCurious   USA  (50 posts)  [Biography] 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!
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] 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
[Go to top] 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.


3,338 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]