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

Gammon Software Solutions forum

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

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Getting Started
. . -> [Subject]  YouTube video showing how to make an inventory alias

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

YouTube video showing how to make an inventory alias

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Pages: 1  2  3  4  5  6  7  8 

Posted by Tiredchris   (17 posts)  [Biography] bio
Date Reply #105 on Tue 11 Dec 2012 05:02 AM (UTC)  quote  ]
Message
I want to get to where I don't need to ask anymore about how the windows work. Slowly getting better at it, but allot still confuses me.

Also, for the mud I'm playing I've been noting everything on our own forums so other people can use mushclient as well. It'd be easier on some of them to just be able to select all and paste into the alias window.
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Reply #106 on Tue 11 Dec 2012 06:51 AM (UTC)  quote  ]
Message
Yes, but this is exactly what plugins were designed for.

To handle window dragging, your script has to respond to a mouse-down in the miniwindow. Now that isn't anything to do with someone typing an alias. And to handle loading stuff (like configuration) and saving stuff for next time, and other things, like doing something every minute, suddenly you are asking people to copy and paste a couple of aliases, copy and paste a couple of triggers, add a few timers, modify their script file, set the correct language, etc.

So instead of all this you say: download this file, install it, done!

That's what plugins are for.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by CincyMush   (15 posts)  [Biography] bio
Date Reply #107 on Sun 30 Dec 2012 08:09 AM (UTC)  quote  ]
Message
Just a quick question is there an easy way to omit this output from my main display since it is going to the window any way. I know triggers have the flag for omitting output is their something similar for aliases?
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Reply #108 on Sun 30 Dec 2012 09:43 PM (UTC)  quote  ]
Message
I'm pretty sure an "omit from output" flag was added, and is discussed in one of the earlier pages of this thread. Just browse through it to find it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by CincyMush   (15 posts)  [Biography] bio
Date Reply #109 on Mon 31 Dec 2012 10:00 AM (UTC)  quote  ]
Message
Oh Sorry I missed that, since they had changed over to a trigger I glossed over it. One more question if I wanted to add a scroll bar to the inventory window and allow it to be resized what should I look at for reference?


Thanks
[Go to top] top

Posted by Fiendish   USA  (848 posts)  [Biography] bio   Global Moderator
Date Reply #110 on Tue 01 Jan 2013 08:35 PM (UTC)  quote  ]
Message
Quote:
One more question if I wanted to add a scroll bar to the inventory window and allow it to be resized what should I look at for reference?


http://www.mushclient.com/forum/?id=10728&reply=82#reply82


http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Panaku   (6 posts)  [Biography] bio
Date Reply #111 on Tue 05 Mar 2013 05:51 AM (UTC)  quote  ]

Amended on Wed 06 Mar 2013 03:24 AM (UTC) by Panaku

Message
Trying to get this working in my mud and having some difficulties, I got past the first few problems and its not giving any errors for now.

When the alias fires it doesn't recognize that the inventory is being displayed, most likely because of how the inventory is listed in this mud.

<aliases>
  <alias
   name="Inventory_Script"
   match="inv"
   enabled="y"
   group="Inventory"
   send_to="12"
   sequence="100"
  >
  <send>require "wait"

wait.make (function ()

local win = GetPluginID () .. ":inventory"
local font = "f"

if not WindowInfo (win, 1) then
  WindowCreate (win, 0, 0, 0, 0, 6, 0, 0)
  WindowFont (win, font, "FixedSys", 9)
end -- if

-- request inventory

Send "inventory"

-- wait for inventory to start

local x = wait.match ("You are carrying (.*?)", 10)

if not x then
  ColourNote ("white", "blue", "No inventory receieved within 10 seconds.")
  return
end -- if

local inv = {}
local max_width = WindowTextWidth (win, font, "Inventory")

-- loop until end of inventory
while true do
  local line, wildcards, styles = wait.match ("*")

  -- see if end of inventory
  
  if string.match (line, "^(.*?) | [Pain: (.*?)") then
    break
  end -- if

  -- save inventory
  table.insert (inv, styles)
  -- work out max width
  max_width = math.max (max_width, WindowTextWidth (win, font, line))

end -- while loop

require "tprint"
tprint (inv)

end)</send>
  </alias>
</aliases>


Below is an example of output from my mud.
You are carrying four ruelbone monads, a bowie knife, a pair of green gauntlets, a pair of buckskin pants, a pair of green armwraps, a
silver-trimmed blue cloak, a wooden practice sword, and a canvas pouch.
-E-W-- | [Pain: 0 Fatigue: 0 Unbalance: 0 Fear: 0] |  [///] > 
The first few lines are my inventory and the last line is my prompt. Any suggestions on getting it to read each item?
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Reply #112 on Tue 05 Mar 2013 06:00 AM (UTC)  quote  ]
Message
Quote:


local x = wait.match ("You are carrying (.*?)", 10)



Change wait.match to wait.regexp, as that looks like a regular expression.

Or change it to:


local x = wait.match ("You are carrying *", 10)

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


29,151 views.

This is page 8, subject is 8 pages long:  [Previous page]  1  2  3  4  5  6  7  8 

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

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

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]