[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]  Getting Started
. . -> [Subject]  Video showing how to make an inventory alias
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Video showing how to make an inventory alias

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


Pages: 1  2  3  4  5 6  7  8  9  10  

Posted by Curtis_D   (32 posts)  [Biography] bio
Date Reply #60 on Wed 07 Mar 2012 05:32 PM (UTC)
Message
That nearly worked perfectly! It was still showing the trigger line though for some reason. But I dug around in the help file and found something that worked to prevent that from showing up:

SetTriggerOption ("planter_mod", "omit_from_output", "y")


I also added the Alias to close the window. I'm very pleased with this progress, thank you very much Nick!!

I'm going to use this same type of thing for several other windows that I hope to create.

My big goal however is to create a window that doesn't pull output from the Mu*, but instead is based on a compilation of various useful commands that the muck uses (that I would define) that when you hover the mouse over a command, it gives you a brief message of what it does, and when you click on one of the commands it executes it.

Just a neat idea I had.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #61 on Thu 08 Mar 2012 04:24 AM (UTC)
Message
Check out this:

http://www.gammon.com.au/forum/?id=9664

That does that sort of thing. And the actual text is just in a table so you can easily modify it for your MUD.

- Nick Gammon

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

Posted by Jsportive-Thalanvor   Netherlands  (71 posts)  [Biography] bio
Date Reply #62 on Sat 10 Mar 2012 06:02 PM (UTC)
Message
with the new inventory you are noted of the amount of items you are carrying in the 5 spaces before the item.
how do you get around that?

Example: (copied from game)

You are carrying:
(10) (Glow) (Hum) (!(Griffon's Blood)!) (1)
(14) (!(Eyes of Allegiance)!) (4)
(12) (!(Eyes of the Wolf)!) (1)
(15) (!(Sight Beyond Sight)!) (1)
(19) (!(Triton Extract)!) (4)
     (K) (Glow) a garbage can (6)
( 2) (Seekers) Elixir of Maneuverability (48)
     (K) a magical pocket (180)
     (K) (Glow) (Hum) Goblet of the Well Educated (1)
     (K) Aylorian Academy canoe (1)
     (K) (Glow) (Hum) a demon school backpack (157)
     (K) a magical pocket (178)
( 4) Aylorian Academy packed lunch (1)

don't pay attention to 'what' i'm carrying, just the (##) in front of the items.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #63 on Sun 11 Mar 2012 04:41 AM (UTC)
Message
The alias looks for 5 spaces to end the inventory, here:


 -- see if end of inventory

  if not string.match (line, "^     ") then
    break
  end -- if


But you need to "allow" the brackets and numbers. So it would be something like this:


 -- see if end of inventory

  if not string.match (line, "^%([ %d]%d%) ") then
    if not string.match (line, "^     ") then
      break
    end -- if
  end -- if


The first "if" is looking for a bracket followed by a space or digit, followed by a digit, and another bracket, then a space.

If it matches that it doesn't do the second test. Untested but that should be roughly it.

- Nick Gammon

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

Posted by Jsportive-Thalanvor   Netherlands  (71 posts)  [Biography] bio
Date Reply #64 on Sun 11 Mar 2012 04:58 AM (UTC)

Amended on Sun 11 Mar 2012 05:01 AM (UTC) by Jsportive-Thalanvor

Message
i'll be testing it right now. thnx.

[EDIT] it works!! thank you very much!!
( i was almost going to start using the Bast inv,
but that one has an enormous annoying item id tab
that doesn't really work :P )
[Go to top] top

Posted by Jsportive-Thalanvor   Netherlands  (71 posts)  [Biography] bio
Date Reply #65 on Mon 12 Mar 2012 08:07 AM (UTC)

Amended on Mon 12 Mar 2012 09:58 AM (UTC) by Jsportive-Thalanvor

Message
i'm trying to get a window to latch to the bottom of the inventory window.
the example is my demon school backpack.

completely watched your inv alias vids multiple times :P and changed everything i needed match it usable for the backpack.
only to get stuck right after tutorial1.


require "wait"

wait.make (function ()  -- coroutine starts here

local win = GetPluginID ( ) .. ":A Demon School Backpack"
local font = "f"

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

-- request backpack

Send "look in backpack"

-- wait for backpack to start

local x = wait.match ("The demon school backpack contains:", 10)

if not x then
  ColourNote ("white", "blue", "No backpack received within 10 seconds")
  return
end -- if

local inv = {}
local max_width = WindowTextWidth (win, font, "a demon school backpack")

-- loop until end of backpack

while true do
  local line, wildcards, styles = wait.match ("*")

-- see if end of backpack

  if not string.match (line, "^%([ %d]%d%) ") then
    if not string.match (line, "^     ") then
      break
    end -- if
  end -- if

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

end -- while loop

require "tprint"

tprint (backpack)




end)  -- end of coroutine

errormessage appearing:

Compile error
World: Aardwolf
Immediate execution
[string "Alias: "]:42: '=' expected near 'backpack'


ps: the only thing i wanted to know is how do i 'latch' it to the bottom of the inventory window, even if the inventory window resizes. but i first have to get the 'backpack' alias to work :P
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #66 on Mon 12 Mar 2012 12:08 PM (UTC)
Message
Quote:
save backpack line

should probably be a comment (preceded by "--")

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Jsportive-Thalanvor   Netherlands  (71 posts)  [Biography] bio
Date Reply #67 on Mon 12 Mar 2012 01:19 PM (UTC)

Amended on Mon 12 Mar 2012 01:20 PM (UTC) by Jsportive-Thalanvor

Message
did that. got the next message.
in 3 colours :P pink, light orange and dark orange :P

Error raised in trigger function (in wait module)
stack traceback:
        [C]: in function 'insert'
        [string "Alias: "]:43: in function <[string "Alias: "]:3>
Run-time error
World: Aardwolf
Function/Sub: wait.trigger_resume called by trigger
Reason: processing trigger "wait_trigger_10844"
C:\Aardwolf\MUSHclient\lua\wait.lua:67: [string "Alias: "]:43: bad argument #1 to 'insert' (table expected, got nil)
stack traceback:
        [C]: in function 'error'
        C:\Aardwolf\MUSHclient\lua\wait.lua:67: in function <C:\Aardwolf\MUSHclient\lua\wait.lua:59>

and right after that it shows the contents of backpack
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #68 on Tue 13 Mar 2012 12:29 AM (UTC)
Message
It looks like you didn't designate backpack as a table.
put

backpack = {}

at the beginning

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Curtis_D   (32 posts)  [Biography] bio
Date Reply #69 on Tue 13 Mar 2012 05:02 AM (UTC)

Amended on Tue 13 Mar 2012 12:09 PM (UTC) by Curtis_D

Message
I've been contemplating modifying this script to create a "Pager system"

On the MUCK I play on I'm pretty well known for putting chats on the wrong spot, for instance saying something on the public channel that was meant for a page to a specific player. This can have som serious implications if secret RP information is accidentally revealed.

Because of this issue that I have I have been thinking of building an Alias or trigger that, when issued, starts up a Pager window for the user specified. For instance,

"Pager Frank" would start a pager window for someone named Frank.

I want to make it so that there is a command prompt window at the bottom (similar to an Instant Messenger) that when you type anything into it, it automatically appends the text "page Frank" at the begining of the text.

Also, any output that has:
<page> Frank pages, "*", to you.
<page> In a page-pose to you, Frank *.
<page> You page, "*", to Frank.
<page> You page-pose *, to Frank.

should be redirected to that pager window.

Also, since conversations can get lengthy, is it possible to have a scroll bar for each pager window?

I've written some ideas for this down on paper but because of my long work hours I haven't had a chance to fully put it together.

Thanks for taking a look! No reply needed I just wanted to put this out there - possibly to see if it was doable, or if it has already been done since I searched the forum and couldn't find something that matched what I was looking for.

Edit: Actually I do have 1 question off the top of my head. Since I want to be able to open more than 1 window at a time, would this work to name the windows different each time?


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

require "wait"

wait.make (function ()  -- coroutine starts here


local win = GetPluginID () .. ":pager%1"





Curt
[Go to top] top

Posted by Jsportive-Thalanvor   Netherlands  (71 posts)  [Biography] bio
Date Reply #70 on Tue 13 Mar 2012 11:27 AM (UTC)
Message
yey, the table worked!! thnx. i'll be watching vid 2 now to complete!

but i still need info on how to 'latch' the backpack window to the bottom side of the inv window.
[Go to top] top

Posted by Jsportive-Thalanvor   Netherlands  (71 posts)  [Biography] bio
Date Reply #71 on Tue 13 Mar 2012 12:02 PM (UTC)

Amended on Tue 13 Mar 2012 12:13 PM (UTC) by Jsportive-Thalanvor

Message
when watching vid 2, almost complete, i get the next error after it lists whats in my backpack:
in 3 colours :P pink, light orange dark orange but i don't know if i can use the colours here.

Error raised in trigger function (in wait module)
stack traceback:
        [C]: in function 'WindowCreate'
        [string "Alias: "]:56: in function <[string "Alias: "]:3>
Run-time error
World: Aardwolf
Function/Sub: wait.trigger_resume called by trigger
Reason: processing trigger "wait_trigger_885"
C:\Aardwolf\MUSHclient\lua\wait.lua:67: [string "Alias: "]:56: bad argument #5 to 'WindowCreate' (number expected, got nil)
stack traceback:
        [C]: in function 'error'
        C:\Aardwolf\MUSHclient\lua\wait.lua:67: in function <C:\Aardwolf\MUSHclient\lua\wait.lua:59>


and this is what's inside my alias


require "wait"

wait.make (function ()  -- coroutine starts here

local win = GetPluginID ( ) .. ":A Demon School Backpack"
local font = "f"

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

-- request backpack

Send "look in backpack"

-- wait for backpack to start

local x = wait.match ("The demon school backpack contains:", 10)

if not x then
  ColourNote ("white", "blue", "No backpack received within 10 seconds")
  return
end -- if

local backpack = {}
local max_width = WindowTextWidth (win, font, "a demon school backpack")

-- loop until end of backpack

while true do
  local line, wildcards, styles = wait.match ("*")

-- see if end of backpack

  if not string.match (line, "^%([ %d]%d%) ") then
    if not string.match (line, "^     ") then
      break
    end -- if
  end -- if

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

end -- while loop

local font_height = WindowFontInfo (win , font , 1)

local window_width = max_width + 10
local window_heith = font_height * (#backpack + 2) + 10

-- make window correct size

WindowCreate (win, 0, 0, window_width, window_height, 7, 0, ColourNameToRGB "#373737")
WindowRectOp (win, 5, 0, 0, 0, 0, 5, 15 + 0x1000)

-- heading line

WindowText (win, font, "a Demon School Backpack", 5, 5, 0, 0, ColourNameToRGB (yellow))

-- draw each inventory line

local y = font_height * 2 + 5

for i, styles in pairs (backpack) do

  local x = 5
  for _, style in ipairs (styles) do
   x = x + WindowText (win, font, style.text, x, y, 0, 0, style.textcolour)
  end -- for
  y = y + font_eight

end -- for each backpack item

WindowShow (win, true)


end)  -- end of coroutine


[Go to top] top

Posted by Jsportive-Thalanvor   Netherlands  (71 posts)  [Biography] bio
Date Reply #72 on Tue 13 Mar 2012 06:14 PM (UTC)
Message
found most of the bugs, but not all. will send error message later.
still not know what this error means:


Error raised in trigger function (in wait module)
stack traceback:
        [string "Alias: "]: in function <[string "Alias: "]:3>
[Go to top] top

Posted by Jsportive-Thalanvor   Netherlands  (71 posts)  [Biography] bio
Date Reply #73 on Tue 13 Mar 2012 06:16 PM (UTC)
Message
nvm, got it, it works.
but still would like to know how to 'latch' it to inventory window.
is it possible?
[Go to top] top

Posted by Jsportive-Thalanvor   Netherlands  (71 posts)  [Biography] bio
Date Reply #74 on Wed 14 Mar 2012 06:47 PM (UTC)
Message
Nick Gammon said:

The alias looks for 5 spaces to end the inventory, here:


 -- see if end of inventory

  if not string.match (line, "^     ") then
    break
  end -- if


But you need to "allow" the brackets and numbers. So it would be something like this:


 -- see if end of inventory

  if not string.match (line, "^%([ %d]%d%) ") then
    if not string.match (line, "^     ") then
      break
    end -- if
  end -- if


The first "if" is looking for a bracket followed by a space or digit, followed by a digit, and another bracket, then a space.

If it matches that it doesn't do the second test. Untested but that should be roughly it.


if i wanted to match the following:


[ Primary Weapon      ]: 


what would that be? i can't seem to find how to match the [ or the ]
i would guess something like:

if not string.match (line, "^[ (*)]: ")

but i'm not sure :S because the digits in the previous example include the [] so i thought it would mean something inside the match.
[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.


113,003 views.

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

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]