Shryke2010-08-03 05:14:37
I should probably search more extensively through the functions, but is there a function in Mushclient that shows the absolute pixel value of the four corners of the screen (that is, four corners of the world window)? It'd be -very- useful for my GUI creation to respect window resizing!
Thanks in advance!
If I find the answer before someone else I'll edit it in if anyone is interested. Mushclient GUI possibilities are making me excited!
edit: clarity
Thanks in advance!
If I find the answer before someone else I'll edit it in if anyone is interested. Mushclient GUI possibilities are making me excited!
edit: clarity
Xavius2010-08-03 05:28:29
QUOTE (Shryke @ Aug 3 2010, 12:14 AM) <{POST_SNAPBACK}>
I should probably search more extensively through the functions, but is there a function in Mushclient that shows the absolute pixel value of the four corners of the screen (that is, four corners of the world window)? It'd be -very- useful for my GUI creation to respect window resizing!
Thanks in advance!
If I find the answer before someone else I'll edit it in if anyone is interested. Mushclient GUI possibilities are making me excited!
edit: clarity
Thanks in advance!
If I find the answer before someone else I'll edit it in if anyone is interested. Mushclient GUI possibilities are making me excited!
edit: clarity
world.GetWorldWindowPosition()
From the helps:
QUOTE
Lua notes
In Lua it returns a table with four entries, like this:
top 0
height 479
left 0
width 669
Lua has an optional argument which is the window number to examine. The first (main) window is window 1.
If you do Window -> New Window then you will get more windows, these will be 2, 3, 4 and so on.
You can use GetInfo (235) to find how many windows are currently open.
If you specify a window that does not exist you will get a nil result.
When using Lua the function GetWorldWindowPosition can take an optional second argument. If true, the world window position is reported in screen co-ordinates (that is, relative to the top-left corner of your monitor) rather than the default of relative to the main MUSHclient window. This lets you write plugins (like graphical status bars) that know where the world window is actually on the screen, so they can be drawn to be nearby.
Return value
Returns a string in the form:
left,top,width,height
eg. "0,0,669,479"
For Lua, returns a table containing:
top=(value)
height=(value)
left=(value)
width=(value)
In Lua it returns a table with four entries, like this:
top 0
height 479
left 0
width 669
Lua has an optional argument which is the window number to examine. The first (main) window is window 1.
If you do Window -> New Window then you will get more windows, these will be 2, 3, 4 and so on.
You can use GetInfo (235) to find how many windows are currently open.
If you specify a window that does not exist you will get a nil result.
When using Lua the function GetWorldWindowPosition can take an optional second argument. If true, the world window position is reported in screen co-ordinates (that is, relative to the top-left corner of your monitor) rather than the default of relative to the main MUSHclient window. This lets you write plugins (like graphical status bars) that know where the world window is actually on the screen, so they can be drawn to be nearby.
Return value
Returns a string in the form:
left,top,width,height
eg. "0,0,669,479"
For Lua, returns a table containing:
top=(value)
height=(value)
left=(value)
width=(value)
Shryke2010-08-03 06:13:28
Thanks Xavius.
Esano also gets credit for pointing me towards GetInfo(280) and GetInfo(281) which show the pixel # for bottom edge and right edge respectively.
Yeehaw, dynamically scaling GUI panels!
Esano also gets credit for pointing me towards GetInfo(280) and GetInfo(281) which show the pixel # for bottom edge and right edge respectively.
Yeehaw, dynamically scaling GUI panels!
Shryke2010-08-04 23:11:20
New question: Is it the case that hotspots really don't work if not in a plugin?
This link makes me think they should work (last post by N.G.) : http://www.gammon.com.au/forum/?id=8963&page=2
However, my work with the bastards implies that they will not work, unless they are indeed in a plugin... grrr to say the least. Feel free to look over my code if you are skeptical.
On that note, willing to take suggestions to make my code prettier
Edit: Tested it within note and it returns message only allowed in a plugin so I guess that answers my question (unless there is some crazy workaround)
This link makes me think they should work (last post by N.G.) : http://www.gammon.com.au/forum/?id=8963&page=2
However, my work with the bastards implies that they will not work, unless they are indeed in a plugin... grrr to say the least. Feel free to look over my code if you are skeptical.
CODE
--]--
if not hspt then
    hspt = {
        list = {"nw", "ne", "sw", "se"},
        win = "hot_panel"}
end
function hspt:calc()
    local mw_width = WindowInfo(self.win, 3)    -- mw stands for 'miniwindow'
    local mw_height = WindowInfo(self.win, 4)
    local mw_center_x = mw_width / 2        -- since I'm dividing the box into 4 boxes, this x/y coordinate set is very useful!
    local mw_center_y = mw_height / 2
    self.nw = {
        x1 = 0,
        y1 = 0,
        x2 = mw_center_x,
        y2 = mw_center_y
        }
    self.ne = {
        x1 = mw_center_x + 1,    -- add one pixel to avoid overlap
        y1 = 0,
        x2 = mw_width,
        y2 = mw_center_y
        }
    self.sw = {
        x1 = 0,
        y1 = mw_center_y + 1,
        x2 = mw_center_x,
        y2 = mw_height
        }
    self.se = {
        x1 = mw_center_x + 1,
        y1 = mw_center_y + 1,
        x2 = mw_width,
        y2 = mw_height
        }
end
function hspt:draw(id)
    if not hspt then
        Note("GUI ERROR: hspt:draw(" .. id .. ") failed due to no hotspot ID data entered into the hspt table")
    else
        WindowAddHotspot(self.win, id, self.x1, self.y1, self.x2, self.y2, "", "", "", "", "hspt:clicked_" .. id, "test text", 1, 0)
    end
end
function hspt:render()
    hspt:calc()
    for _,v in ipairs(hspt.list) do
        hspt:draw(v)
    end
end
return
if not hspt then
    hspt = {
        list = {"nw", "ne", "sw", "se"},
        win = "hot_panel"}
end
function hspt:calc()
    local mw_width = WindowInfo(self.win, 3)    -- mw stands for 'miniwindow'
    local mw_height = WindowInfo(self.win, 4)
    local mw_center_x = mw_width / 2        -- since I'm dividing the box into 4 boxes, this x/y coordinate set is very useful!
    local mw_center_y = mw_height / 2
    self.nw = {
        x1 = 0,
        y1 = 0,
        x2 = mw_center_x,
        y2 = mw_center_y
        }
    self.ne = {
        x1 = mw_center_x + 1,    -- add one pixel to avoid overlap
        y1 = 0,
        x2 = mw_width,
        y2 = mw_center_y
        }
    self.sw = {
        x1 = 0,
        y1 = mw_center_y + 1,
        x2 = mw_center_x,
        y2 = mw_height
        }
    self.se = {
        x1 = mw_center_x + 1,
        y1 = mw_center_y + 1,
        x2 = mw_width,
        y2 = mw_height
        }
end
function hspt:draw(id)
    if not hspt then
        Note("GUI ERROR: hspt:draw(" .. id .. ") failed due to no hotspot ID data entered into the hspt table")
    else
        WindowAddHotspot(self.win, id, self.x1, self.y1, self.x2, self.y2, "", "", "", "", "hspt:clicked_" .. id, "test text", 1, 0)
    end
end
function hspt:render()
    hspt:calc()
    for _,v in ipairs(hspt.list) do
        hspt:draw(v)
    end
end
return
On that note, willing to take suggestions to make my code prettier
Edit: Tested it within note and it returns message only allowed in a plugin so I guess that answers my question (unless there is some crazy workaround)
Unknown2010-08-05 02:35:01
What version of MUSHclient are you using? Hotspots do indeed now work outside of plugins, as per my request a while ago. Either your version is not the latest or you're instantiating the hotspots incorrectly. You need to create a window before you can add a hotspot on top of it.
Shryke2010-08-05 03:30:17
Yeah, I'm on 4.43, about 2 hours ago.
I worked around it by putting it in a plugin but I dislike the solution...
edit: and now downloading MC 4.55
edit2: and to be clear, I render the background (in this case "hot_panel") in a separate script so that wasn't the issue, problem solved time to fry some bigger fish now.
Thanks, thanks and thanks.
Wish you were IG man
I worked around it by putting it in a plugin but I dislike the solution...
edit: and now downloading MC 4.55
edit2: and to be clear, I render the background (in this case "hot_panel") in a separate script so that wasn't the issue, problem solved time to fry some bigger fish now.
Thanks, thanks and thanks.
Wish you were IG man
Shryke2010-08-05 05:33:00
Ok, I am spamming the hell out of this thread, but I now have a seriously obscure and quite possibly not-easy to fix problem!
Explanation:
-I have a hotspot I press to toggle between accelerators (macros)...
-When I click outside of the command box the ticking cursor goes away, and my first keystroke of an accelerated key is not sent, instead this keystroke returns the ticking cursor and following keystrokes behave as they should.
-When not doing an accelerated keystroke, this problem doesn't arise for some reason, the first stroke puts the correct letter into the command box
So, what I'm looking for is to have some way for the first accelerated command after I click outside of the command box to be properly sent (this is fairly important).
As an aside, I've tried the "all typing goes to command window" both ways to no avail.
Thanks!
edit: According to Nick Gammon 'twas a bug will be fixed in 4.56 when released. Woot
Explanation:
-I have a hotspot I press to toggle between accelerators (macros)...
-When I click outside of the command box the ticking cursor goes away, and my first keystroke of an accelerated key is not sent, instead this keystroke returns the ticking cursor and following keystrokes behave as they should.
-When not doing an accelerated keystroke, this problem doesn't arise for some reason, the first stroke puts the correct letter into the command box
So, what I'm looking for is to have some way for the first accelerated command after I click outside of the command box to be properly sent (this is fairly important).
As an aside, I've tried the "all typing goes to command window" both ways to no avail.
Thanks!
edit: According to Nick Gammon 'twas a bug will be fixed in 4.56 when released. Woot
Unknown2010-08-07 01:05:04
How does one make an alias work within another alias? Such as
    match="rubup"
  enabled="y"
  sequence="100"
  >
 Ârub beauty
rub mercy
rub perfection
rub kingdom
do rub beads
do rub deathsight
do rub waterbreathe
do rub acquisitio
do rub levitate
 Â
In Treant, there are aliases like "do", "dofree", "dofree1" and "do1". I'm way too used to Zmud in the fact that I can just make an alias and throw that alias within another alias with minimal effort.
CODE
 Â
  enabled="y"
  sequence="100"
  >
 Â
rub mercy
rub perfection
rub kingdom
do rub beads
do rub deathsight
do rub waterbreathe
do rub acquisitio
do rub levitate
 Â
In Treant, there are aliases like "do", "dofree", "dofree1" and "do1". I'm way too used to Zmud in the fact that I can just make an alias and throw that alias within another alias with minimal effort.
Esano2010-08-07 01:17:51
Either "send to execute", or "send to script" and use Execute("whatever")
EDIT: The send to options are under the big command box.
EDIT: The send to options are under the big command box.
Unknown2010-08-07 01:40:59
And, there is a more efficient way to put up defenses with Treant, too, which is documented in the text files.
Thendis2010-08-07 02:02:43
Hmm... I used to be able to hover over a line and the time it happened would pop up, but it went away when I installed Treant. Some world setting I didn't transfer? Treant doesn't like me? Trade off for being able to play video as my desktop background?
Unknown2010-08-07 02:04:31
QUOTE (Zarquan @ Aug 6 2010, 06:40 PM) <{POST_SNAPBACK}>
And, there is a more efficient way to put up defenses with Treant, too, which is documented in the text files.
Hah! I forgot about that.
Unknown2010-08-07 02:07:21
The Treant template world has the option turned off (because I find it very annoying). In your world properties, go to Output and check 'Show Line Information.'
Thendis2010-08-07 02:12:53
thank you!
Unknown2010-08-08 02:59:55
I'm using lua in MUSHclient and am trying to get the AddTrigger and AddAlias functions to work properly.
I can't figure out how to make it place multiple script commands like both Send ("look") and Send ("ql") in the same created alias or trigger.
I also can't figure out how to get it to set multiple flags. I tried both the | as well as or but neither worked.
Edit:
On a side note, I read the bit on streamlining things and am wondering how exactly I'm supposed to move the scripting I have in my triggers into the main script file instead.
I also just realized it's not letting me send script commands to the script, period. It keeps saying ")" expected near
AddTriggerEx ("testtrigger", "You have regained equilibrium.", "Send ("ql")", trigger_flag.Enabled or trigger_flag.OneShot, -1, 0, "", "", 0, 100)
This gives me that error and the flags don't work right.
(the triggering on equilibrium bit is just for testing how the function works)
I can't figure out how to make it place multiple script commands like both Send ("look") and Send ("ql") in the same created alias or trigger.
I also can't figure out how to get it to set multiple flags. I tried both the | as well as or but neither worked.
Edit:
On a side note, I read the bit on streamlining things and am wondering how exactly I'm supposed to move the scripting I have in my triggers into the main script file instead.
I also just realized it's not letting me send script commands to the script, period. It keeps saying ")" expected near
AddTriggerEx ("testtrigger", "You have regained equilibrium.", "Send ("ql")", trigger_flag.Enabled or trigger_flag.OneShot, -1, 0, "", "", 0, 100)
This gives me that error and the flags don't work right.
(the triggering on equilibrium bit is just for testing how the function works)
Shryke2010-08-08 05:18:42
QUOTE (Phantasm @ Aug 7 2010, 07:59 PM) <{POST_SNAPBACK}>
AddTriggerEx ("testtrigger", "You have regained equilibrium.", "Send ("ql")", trigger_flag.Enabled or trigger_flag.OneShot, -1, 0, "", "", 0, 100)
Problem here, need to use different types of quotes when embedding one quote into another. Easy change to "Send('ql')"
Not sure if there is a syntax for putting multiple commands into AddTriggerEx() but you can always make a specific function.. Such as:
AddTriggerEx ("testtrigger", "You have regained equilibrium.", "testtrigger_function()", trigger_flag.Enabled or trigger_flag.OneShot, -1, 0, "", "", 0, 100)
and in your script file have:
function testtrigger_function()
Send("ql")
end
Hope that helps!
Unknown2010-08-08 05:32:54
It's also not letting me have more than one flag, because | and or are just either not working, or making it one shot, but not enabled, respectively.
Shryke2010-08-08 05:54:15
For the flags, if you look at the helpfile you will see that each flag as an associated # value. Each of these numbers is unique, and when adding any combination of the numbers, they create another unique number. So if you want to have multiple flags, add the value for each flag you want together and put that ## in as your flag value.
Example: enabled 1 + omitfromoutput 4 = 5. So 5 will omit from output AND enable the trigger.
Hope that helps
Example: enabled 1 + omitfromoutput 4 = 5. So 5 will omit from output AND enable the trigger.
Hope that helps
Unknown2010-08-08 12:40:19
You can use bit.bor to "or" then together properly, but in most cases adding them up will have the same effect.
You can also build a script using Lua's extended string quoting syntax ], so you could have ] to call two functions in the same alias very easily.
Hope that helps!
You can also build a script using Lua's extended string quoting syntax ], so you could have ] to call two functions in the same alias very easily.
Hope that helps!
Esano2010-08-08 12:54:17
You should also be able to use \\n (or possibly \\\\n?) to insert a newline in the AddTrigger.