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 ➜ Creating screen Layouts

Creating screen Layouts

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


Posted by Ashleykitsune   (33 posts)  Bio
Date Mon 19 Mar 2012 01:40 PM (UTC)

Amended on Tue 20 Mar 2012 02:29 PM (UTC) by Ashleykitsune

Message
Don't worry about this post for right now. I've been working on this for the past couple of hours, and I needed a way to get this data from my work computer to my home computer since my private email is down at the moment.

I'm sure I'll eventually ask for help regarding this, but for now, I'm not even finished with it.


The main concept of this Alias is to allow a user to specify how they want their screen's Mini Windows to be set up so they can tailor them to their own needs.

So the Alias aims to "turn on" a set of variables/triggers, as well as create mini windows (or hide unused windows).

I am not a programmer by far, so I'm sure this code has many mistakes in it right now, but it's a start.


--I need to make 'layout window variables for use with many interfaces (triggers alias's etc)




<aliases>
  <alias
   match="+layout=(battle|ooc|ic)$"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>

local layout = %1 -- Create a var named layout with the value of whatever the wildcard was used for the Alias

-- determine what layout was requested and then set the global variables to reflect this as well as enable the specific trigger set that goes with it.
if layout == "battle" then
    SetVariable(battlelayout) == 1
      SetTriggerOption ("battlewindow_mod", "enabled", 1)
    SetVariable(ooclayout) == 0
      SetTriggerOption ("oocwindow_mod", "enabled", 0)
    SetVariable(iclayout) == 0
      SetTriggerOption ("icwindow_mod", "enabled", 0)

    local battlewin = GetPluginID () .. ":battlewindow" -- get a unique name for Var battlewin
    WindowCreate (battlewin, 0, 0, 400, 800, 4, 10, ColourNameToRGB("white"))  -- create window
    
    local battlewin2 = GetPluginID () .. ":battlewindow2" -- get a unique name for Var battlewin2
    WindowCreate (battlewin, 0, 400, 400, 800, 0, 10, ColourNameToRGB("white"))  -- create window

    local dexwin = GetPluginID () .. ":dexwindow" -- get a unique name for Var dexwin
    WindowCreate (oocwin, 0, 0, 200, 200, 12, 0, ColourNameToRGB("white"))  -- create window


end --if

if layout == "ooc" then
    SetVariable(battlelayout) == 0
      SetTriggerOption ("battlewindow_mod", "enabled", 0)
    SetVariable(ooclayout) == 1
      SetTriggerOption ("oocwindow_mod", "enabled", 1)
    SetVariable(iclayout) == 0
      SetTriggerOption ("icwindow_mod", "enabled", 0)
end --if

if layout == "ic" then
    SetVariable(battlelayout) == 1
      SetTriggerOption ("battlewindow_mod", "enabled", 0)
    SetVariable(ooclayout) == 0
      SetTriggerOption ("oocwindow_mod", "enabled", 0)
    SetVariable(iclayout) == 0
      SetTriggerOption ("icwindow_mod", "enabled", 1)
end --if


-- Create windows - but not show yet


-- Main window for ooc text  while RPing
local oocwin = GetPluginID () .. ":oocwindow" -- get a unique name for Var oocwin
WindowCreate (oocwin, 0, 0, 200, 200, 12, 0, ColourNameToRGB("white"))  -- create window

-- Main window for battle data
local icwin = GetPluginID () .. ":icwindow" -- get a unique name for Var icwin
WindowCreate (oocwin, 0, 0, 200, 200, 12, 0, ColourNameToRGB("white"))  -- create window

-- Main window for battle data
local whowin = GetPluginID () .. ":whowindow" -- get a unique name for Var whowin
WindowCreate (oocwin, 0, 0, 200, 200, 12, 0, ColourNameToRGB("white"))  -- create window







if layout == "battle" then
WindowShow (battlewin,  true)  -- show Battlewindow miniwindow




if not WindowInfo (battlewin, 1) then
  WindowCreate (battlewin, 0, 0, 0, 0, 4, 0, 0)  -- positioned at the top left corner
  WindowFont (battlewin, font, "Lucida Console", 9)  
end -- if
      battleenabled = GetTriggerOption ("battlewindow_mod", "enabled")
   end -- if
end -- if

if battleenabled == 1 then
   print
</send>
  </alias>
</aliases>
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #1 on Mon 19 Mar 2012 04:44 PM (UTC)
Message
Looks interesting. You can use Dropbox.com in the future. :D

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Ashleykitsune   (33 posts)  Bio
Date Reply #2 on Tue 20 Mar 2012 02:29 PM (UTC)

Amended on Tue 20 Mar 2012 06:28 PM (UTC) by Ashleykitsune

Message
Well I have the first trigger set up, but I haven't had a chance to really test it yet.

I do have a problem with it though. The way the "break" is set up:
  if string.match (line, "&amp;lt;Battle&amp;gt; Input command for *. +attack +item +switch +run") then
  print ("Battle")
    break
  end -- if

Since it's the same as the Inventory Alias, it won't pull the line used for string.match, which is something I need it to do. I need the last line to show up in the window to be this line. Nothing else prints after this line, so how can I accomplish this?


<triggers>
  <trigger
   match="^\=\=(.*?)\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=Team\=(.*?)\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=$"
   name="battlewindow_mod"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>require "wait"

wait.make (function ()  -- coroutine starts here
SetTriggerOption ("battlewindow_mod", "omit_from_output", "y")


local font = "f"

  WindowFont (battlewin, font, "Lucida Console", 9)  
end -- if

local battlewindow = { TriggerStyleRuns }
local max_width = WindowTextWidth (battlewin, font, "Battlewindow")

-- loop until end of battlewindow data

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

-- see if end of battlewindow data

  if string.match (line, "&amp;lt;Battle&amp;gt; Input command for *. +attack +item +switch +run") then
  print ("Battle")
    break
  end -- if

  -- save battlewindow data lines
  table.insert (battlewindow, styles)
  -- work out max width
  max_width = math.max (max_width, WindowTextWidth (battlewin, font, line))

end -- while loop

local font_height = WindowFontInfo (battlewin, font, 1)

local window_width = max_width + 10
local window_height = font_height * (#battlewindow + 2) + 10

-- make window correct size

WindowCreate ("battlewin", 0 , 0 , 640 , 100 , 0 , 0 , ColourNameToRGB ("blue") )
WindowRectOp ("battlewin", 1, 5, 635, 635, 95, ColourNameToRGB ("black"))

-- heading line

WindowText (battlewin, font, "Battlewindow", 5, 5, 0, 0, ColourNameToRGB  "yellow")

-- draw each inventory line

local y = font_height * 2 + 5

for i, styles in ipairs (battlewindow) do

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

end -- for each battlewindow data item

WindowShow (battlewin, true)


end)   -- end of coroutine
</send>
  </trigger>
</triggers>
Top

Posted by Ashleykitsune   (33 posts)  Bio
Date Reply #3 on Tue 20 Mar 2012 02:30 PM (UTC)
Message
Twisol said:

Looks interesting. You can use Dropbox.com in the future. :D


That would be cool, but I can't reach that website from work, it's blocked.
Top

Posted by Fiendish   USA  (2,535 posts)  Bio   Global Moderator
Date Reply #4 on Wed 21 Mar 2012 12:01 AM (UTC)
Message
Can you reach pastebin?

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Ashleykitsune   (33 posts)  Bio
Date Reply #5 on Wed 21 Mar 2012 01:01 PM (UTC)
Message
Fiendish said:

Can you reach pastebin?


I'm afraid not. Actually I'm surprised I can even make it to this website.
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.


20,435 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.