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 ➜ General ➜ Can mush access the database such as excel or access?

Can mush access the database such as excel or access?

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


Posted by Phost   (11 posts)  Bio
Date Mon 07 Sep 2009 06:56 AM (UTC)
Message
hello!i always have so much problems.sorry!
now i have learned that mush can access the database such as sqlite. can mush deal with the excel or access database
what i want to do is
Name do
kitchen w;s;s;s
liveroom n;n;u
stable w;s;s;n;nw
where name and do is field of the database.

in zmud,i use the command
place=liveroom;#find @place,do=&do,#exec @do
then i can goto the liveroom
the database i already created is about 1000 records of
each place name and how to go there,but it is excel format.
how can i use it in mush?
thanks!!
Top

Posted by Nick Gammon   Australia  (23,159 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 07 Sep 2009 09:05 PM (UTC)
Message
There are various ways you could do this, including using a COM object to access the Excel database, but I think this would be slow, as that would mean Excel has to load every time.

The solution below will be nice and fast. :)


  • Save the plugin below to disk as directed in the instructions.

  • Open Excel to get at your database of speedwalks, and then "save as comma-delimited" file (CSV file). That should give you a file like this:

    
    kitchen, w;s;s;s
    liveroom, n;n;u
    stable, w;s;s;n;nw
    


    Open that file in a text editor and copy those lines into the plugin, replacing the example three lines (in bold) with your 1000 or so lines.

  • Save the amended plugin (and do a plugin reinstall if you have already installed it).

  • Now you can just type "goto kitchen" and it will do the speedwalk.


If you need to add or amend speedwalks just open the plugin in a text editor and fix up the list in the speedwalks part.

Template:saveplugin=Speedwalker To save and install the Speedwalker plugin do this:
  1. Copy between the lines below (to the Clipboard)
  2. Open a text editor (such as Notepad) and paste the plugin into it
  3. Save to disk on your PC, preferably in your plugins directory, as Speedwalker.xml
  4. Go to the MUSHclient File menu -> Plugins
  5. Click "Add"
  6. Choose the file Speedwalker.xml (which you just saved in step 3) as a plugin
  7. Click "Close"



<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Tuesday, September 08, 2009, 6:59 AM -->
<!-- MuClient version 4.43 -->

<!-- Plugin "Speedwalker" generated by Plugin Wizard -->

<muclient>
<plugin
   name="Speedwalker"
   author="Nick Gammon"
   id="fa0ecbb1922e2aa85abf94d1"
   language="Lua"
   purpose="Goes to a place from a speedwalk table"
   date_written="2009-09-08 06:58:32"
   requires="4.40"
   version="1.0"
   >
<description trim="y">
<![CDATA[
Type : goto <place>

Edit the plugin to add more places.
]]>
</description>

</plugin>


<!--  Aliases  -->

<aliases>
  <alias
   match="goto *"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>

-- lookup place
sw = speedwalk_table [trim ("%1")]

if not sw then
  ColourNote ("white", "red", "Place '%1' not in database")
else
  Execute ((string.gsub (sw, ";", "\\n")))
end -- if

</send>
  </alias>
</aliases>

<!--  Script  -->


<script>
<![CDATA[

-- trim leading and trailing spaces from a string
function trim (s)
  return (string.gsub (s, "^%s*(.-)%s*$", "%1"))
end -- trim


-- PUT SPEEDWALKS HERE BETWEEN BRACKETS:

speedwalks = [[
kitchen, w;s;s;s
liveroom, n;n;u
stable, w;s;s;n;nw
]]

speedwalk_table = {}

-- copy into table
for name, sw in string.gmatch (speedwalks, "([A-Za-z]+),(.-)\n") do
  speedwalk_table [trim (name)] = trim (sw)
end -- for

]]>
</script>


</muclient>


- Nick Gammon

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

Posted by Phost   (11 posts)  Bio
Date Reply #2 on Tue 08 Sep 2009 01:04 AM (UTC)
Message
i really love you,nick!
thank you so much!
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.


10,900 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.