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 ➜ Suggestions ➜ Buttons

Buttons

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


Posted by NightFire   (2 posts)  Bio
Date Wed 18 Sep 2002 07:40 AM (UTC)

Amended on Wed 18 Sep 2002 07:41 AM (UTC) by NightFire

Message
I know zmud supports some nifty buttons that you can use to tell if an affect has worn off or something. I`m not sure if it could be done with scripting so I`m just gonna put it here. Triggers don't really work for this cuz if your in combat, and try to reapply the skill it wont always work. Be nice to have a set up where there are say ten buttons on the side that are always shown, with the names of skills in them that say, change color when something wears off. It would change colors back and forth by letting you input elsewhere the messages when the affects wear off and when the skill is successful..understand what I`m trying to say?
Top

Posted by Shadowfyr   USA  (1,791 posts)  Bio
Date Reply #1 on Wed 18 Sep 2002 08:12 AM (UTC)

Amended on Wed 18 Sep 2002 08:13 AM (UTC) by Shadowfyr

Message
Yep. And it is already on the list of ideas. In the mean time I did something similar with scripting that displays in output. It uses two timers. One to tick the spell and one the display it.

The following is an example of the triggers, timers and aliases I used:

<triggers>
 <trigger
   enabled="y"
   match="^from your own soul\."
   name="Soullight_Up"
   regexp="y"
   keep_evaluating="y"
   script="ResetTmr"
   sequence="98"
  >
  </trigger>

  <trigger
   enabled="y"
   match="^Your soul light slowly ebbs away\."
   name="Soullight"
   regexp="y"
   keep_evaluating="y"
   script="IcoDrops"
   sequence="99"
  >
  </trigger>

<!-- Used in my case for spells that vary due to wisdom. -->
  <trigger
   enabled="y"
   match="^Your stats are: Str .*, Dex .*, Con .*, Wis (.*), Int .*\."
   name="CatchStat"
   keep_evaluating="y"
   regexp="y"
   script="MakeAdj"
   sequence="98"
  >
  </trigger>
</triggers>

<!--  Timers  -->

<timers>
  <timer name="IconTimer" script="IconDec" enabled="y" second="2" active_closed="y">
  </timer>
  <timer name="ShowThem" script="ShowThem" enabled="y" second="10" active_closed="y">
  </timer>
</timers>

<!-- Aliases  -->
<aliases>
  <alias
   name="IconToggle"
   script="IconToggle"
   match="icons *"
   enabled="y"
  >
  </alias>
</aliases>

The next post(s) are the actual script I use. It is definitely far more complicated than a button bar, but works.
Top

Posted by Shadowfyr   USA  (1,791 posts)  Bio
Date Reply #2 on Wed 18 Sep 2002 08:14 AM (UTC)
Message
The script>
sub OnPluginInstall
  dim Icnm, Ico, Tms, FTms, Colors, IcDrops,Adj,Ada
  Icnm = "WofW_Up,HB_Up,MB_Up,Clock_Up,Godspeed_Up,Godshield_Up,AoR_Up,Inpiration_Up,SG_Up"
  Icnm = Icnm + ",Soulight_Up"
  Ico = "Ww,Hb,Mb,Bc,Sp,Sh,Ar,In,Sg,Sl"
  Tms = "-21,-21,-21,-21,-21,-21,-21,-21,-21,-21" 'Start Disabled.
  FTms = "1450,1750,1790,580,680,1140,900,1,1,620"
  Adj = FTms
  Ada = "0,3,3,0,0,0,0,0,0,0"
  Colors = "#007ffe,#00b2fe,#00e9fe,#00fee0,#00feae" ' Colors by 5% (Blues)
  Colors = Colors & ",#00fe77,#00fe44,#00fe11,#26fe00,#59fe00" '(Greens)
  Colors = Colors & ",#90fe00,#c3fe00,#fafe00,#fecf00,#fe9d00" '(Yellow-Orange)
  Colors = Colors & ",#fe6600,#fe3300,#fe0000,#be4545,#881818" '(Red)
  IcDrops = "Word_of_Wisdom,Health_Bless,Mind_Bless,Body_Clock,Godspeed"
  IcDrops = IcDrops & ",Godshield,AoR,Inspiration,Guardian,Soullight"
  world.setvariable "Icnm",Icnm
  world.setvariable "Ico",Ico
  dim Test,Test2
  Test = split(world.getvariable("Tms"),",")
  Test2 = split(Tms,",")
  if world.getvariable("Tms") = "" or ubound(Test2) <> ubound(Test) then
    world.setvariable "Tms",Tms
  end if
  world.setvariable "FTms",Ftms
  world.setvariable "Colors",Colors
  world.setvariable "IcDrops",IcDrops
  world.setvariable "Adj",Adj
  world.setvariable "Ada",Ada
end sub

function OnPluginCommand (sText)
world.setvariable "LCTime", Now
OnPluginCommand = vbTrue
end function

sub IconToggle (name, output, wildcards)
  dim Flag
  Flag = ucase(wildcards(1))
  if Flag = "RESET" then
    dim Tms
    Tms = split(world.getvariable("Tms"),",")
    dim count
    for count = 0 to ubound(Tms)
      Tms(count) = -21
    next
    world.setvariable "Tms", join(Tms,",")
    world.note "Icon counters reset!"
  end if
  if Flag = "ON" then
    world.enabletimer "ShowThem",1
    world.note "Icons will now display!"
  end if
  if Flag = "OFF" then
    world.enabletimer "ShowThem",0
    world.note "Icons Off!"
  end if
end sub

sub IconDec (name)
  dim Adj 'Adjusted times.
  Adj = split(world.getvariable("Adj"),",")
  dim Ico ' List of icons to display.
  dim Tms ' Current times.
  dim Colors
  Colors = split(world.getvariable("Colors"),",")
  Ico = split(world.getvariable("Ico"),",")
  Tms = split(world.getvariable("Tms"),",")
  dim count
  for count = 0 to ubound(Ico)
    Tms(count) = int(Tms(count)) + 2
    if int(Tms(count)) >= Adj(count) then
      Tms(count) =  Adj(count)
    end if
    if Tms(count) < 0 then 'Make sure it stays gray.
      Tms(count) = -21
    end if
  next
  world.setvariable "Tms", join(Tms,",")    
end sub

sub ShowThem (name)
  if abs(DateDiff("n",world.getvariable("LCTime"),Now)) < 5 then
    call DisplayIt
  end if
end sub

sub ResetTmr (name, output, wildcards)
  dim Icnm ' Names.
  dim Tms ' Current times.
  dim Ada
  Ada = split(world.getvariable("Ada"),",")
  Icnm = split(world.getvariable("Icnm"),",")
  Tms = split(world.getvariable("Tms"),",")
  dim count,test
  test = 0
  for count = 0 to ubound(Icnm)
    if Icnm(count) = name then
      Tms(count) = 0
      if ada(count) > 0 then
        test = 1
      end if
    end if
  next
  world.setvariable "Tms", join(Tms,",")
  if test then
    world.enabletrigger "CatchStat", 1
    world.send "stats"
  end if
end sub

sub IcoDrops (name, output, wildcards)
  dim IcDrops
  dim Tms ' Current times.
  IcDrops = split(world.getvariable("IcDrops"),",")
  Tms = split(world.getvariable("Tms"),",")
  dim count
  for count = 0 to ubound(IcDrops)
    if IcDrops(count) = name then
      Tms(count) = -21
    end if
  next
  world.setvariable "Tms", join(Tms,",")    
  call DisplayIt
end sub

sub DisplayIt ()
  dim Adj
  dim Tms ' Current times.
  dim Ico ' List of icons to display.
  dim Colors
  Adj = split(world.getvariable("Adj"),",")
  Colors = split(world.getvariable("Colors"),",")
  Tms = split(world.getvariable("Tms"),",")
  Ico = split(world.getvariable("Ico"),",")
  world.colourtell "#FFFFFF","#00","["
  dim count
  for count = 0 to ubound(Ico)
    if Tms(count) < 0 then
      world.colourtell "#808080","#00",Ico(count)
    else
      dim cl,Ft
      Ft = Adj(count)
      cl = Tms(count) / Ft
      cl = int(cl * 19)
      if cl > 19 then
        cl = 19
      end if
      world.colourtell Colors(cl),"#00",Ico(count)
    end if
    if count < ubound(Ico) then
      world.colourtell "#FFFFFF","#00","-"
    end if
  next
  world.colournote "#FFFFFF","#00","]"
end sub

sub MakeAdj (name, output, wildcards)
  dim Adj
  dim FTms
  dim Ada
  Adj = split(world.getvariable("Adj"),",")
  Ftms = split(world.getvariable("FTms"),",")
  Ada = split(world.getvariable("Ada"),",")
  world.enabletrigger "CatchStat", 0
  dim ABase, Temp
  ABase = 133
  Temp = int(wildcards(1))
  Temp = Temp - ABase
  dim count,ttime,tad
  for count = 0 to ubound(Adj)
    ttime = Ftms(count)
    tad = Ada(count)
    Adj(count) = ttime + (Temp * tad)
  next
  world.setvariable "Adj", join(Adj,",")    
  call DisplayIt
end sub
Top

Posted by Shadowfyr   USA  (1,791 posts)  Bio
Date Reply #3 on Wed 18 Sep 2002 08:43 AM (UTC)

Amended on Wed 18 Sep 2002 08:45 AM (UTC) by Shadowfyr

Message
Now a bit of explaination. lol

These line set the initial conditions.
'This one is used for the matches that turn on a ticker.
Icnm = "WofW_Up,HB_Up,MB_Up,Clock_Up,Godspeed_Up,Godshield_Up,AoR_Up,Inpiration_Up,SG_Up"
Icnm = Icnm + ",Soulight_Up"

'This contains the items actually displayed like [Ww-Hb-Mb-Bc-Sp-Sh-Ar-In-Sg-Sl]
Ico = "Ww,Hb,Mb,Bc,Sp,Sh,Ar,In,Sg,Sl"

'The current 'tick' of the clock if you will.
'It is needed to allow the colors to cycle, since a timer
'by itself can't do it. The start out in the 'off' setting,
'but are also testing in the same install routine to see if
'they exist. This was for testing purposes while debugging. ;)
Tms = "-21,-21,-21,-21,-21,-21,-21,-21,-21,-21" 'Start Disabled.

'Final times base values, in seconds.
FTms = "1450,1750,1790,580,680,1140,900,1,1,620"
'Actual final times, these are adjusted with the values in
'Ada so they are 'hopefully' accurate based on my wisdom.
'Adding stuff for other stat types could be a problem, but
'this provides a starting point.
Adj = FTms
Ada = "0,3,3,0,0,0,0,0,0,0"

All of the above 'must' have the same number of elements or the script will bomb at some point.

'Duh.. The colors range from a little bluer than cyan to a
'dark red. They are set to black only if a trigger catches
'the fall message, since the time may be off by a bit. ;)
Colors = "#007ffe,#00b2fe,#00e9fe,#00fee0,#00feae" ' Colors by 5% (Blues)
Colors = Colors & ",#00fe77,#00fe44,#00fe11,#26fe00,#59fe00" '(Greens)
Colors = Colors & ",#90fe00,#c3fe00,#fafe00,#fecf00,#fe9d00" '(Yellow-Orange)
Colors = Colors & ",#fe6600,#fe3300,#fe0000,#be4545,#881818" '(Red)

'Names of triggers that result from the spells ending.
IcDrops = "Word_of_Wisdom,Health_Bless,Mind_Bless,Body_Clock,Godspeed"
IcDrops = IcDrops & ",Godshield,AoR,Inspiration,Guardian,Soullight"

Other routines>
OnPluginCommand (sText)
--This keeps track of if you have typed anything in the last five minutes. If not you are assumed idle and the ticker stops displaying (but still updates), until you type a new command. If a spell drops, it will still display the droping.

IconToggle (name, output, wildcards)
--Has three jobs.
---'Icons off' turn off the tickers display.
---'icons on' turns on the display.
---'icons reset' sets all the times to -21, in case the ticker is still going from the last time you closed mushclient.

IconDec (name)
--increases the current tick of all active spells by 2 seconds. Don't ask me why the Colors variable is in there, it is a left over from a prior version. lol

sub ShowThem (name)
--Called every ten seconds to display the bar, if not idle and the display is on.

sub ResetTmr (name, output, wildcards)
--Maybe should be StartTimer.. this gets the name of the trigger that called it, searches the list of Icnm and if found sets the Tms element for it to 0, thus starting the tick for that one.

IcoDrops (name, output, wildcards)
--Same as the previous, but set the element to -21 to stop that ticker and display the dark gray icon.

DisplayIt ()
--The heart of it all, this of course determines what % of the time has passed and displays gray for all non-active tickers and a color for the rest.

MakeAdj (name, output, wildcards)
--Added for my use when dealing with variable spell lengths due to wisdom. This, the trigger, the command in ResetTmr that enables the trigger and the send a 'stat' command in the same place can all be eliminated if this is not an issue. If it is one, then it will likely need to be changed so the trigger that calls it to deal with the stat that effects your spells. If more than one effect them.... Then it will need 'major' changes. lol
Top

Posted by Aggressio   (6 posts)  Bio
Date Reply #4 on Wed 09 Oct 2002 02:03 PM (UTC)
Message
customizable buttons to use in visual controlling of triggers and and as lights to show different statuses would indeed be a great feature to add to mushclient. a separate (but still attached to a world) window to show info like hitpoints etc. in a different window would be also nice. the buttons to turn triggers on/off could also be fixed to the world window, so they would be easily at hand. perhaps variable window-border color also to show status-changes?
Top

Posted by Shadowfyr   USA  (1,791 posts)  Bio
Date Reply #5 on Wed 09 Oct 2002 07:39 PM (UTC)
Message
I'll tell you what I think someone needs to come up with.. Most controls including buttons can through Activex be created and 'attached' to a form, but I can't find any useful way to handle this. In theory all that is needed is:

A) A blank form.
B) An XML style form definition to specify what and where to put stuff and what subs to call on a click event, etc. (limiting the number of such events).

This would create minimal overhead even if built into mushclient itself, since all mushclient needs is the code to create a form, read in the difinition file, add/display the controls and from then on handle those events that make sense to support. In most cases all it would need to watch for are click events. Everything else would be stuff the script reads or sets on the controls.

One benifit of this though would be that button groups like you are talking about could be generated like:

<Form>
  Name = "Spells"
  <Button>
     Name = "Godspeed"
     Caption = "Godspeed"
     Color = "#C0C0C0"
     Left = "10"
     Top = "10"
     Height = "300"
     Width = "1000"
     <Events>
       Click = world.note "godspeed"
     <\Events>
  <\Button>
  <Button>
    ...
  <\Button>
  ...
<\Form>


Then to set the color, etc. you just do Spells.Godspeed.Color = "#00FF00". ;) The only thing I would miss here is an option for using a button with a picture in it, but... Not sure how that works exactly.

I started to design an Activex control that would do this, but VB places limits on creating some objects at runtime. As a result, stuff like textboxes have to be predefined and mearly set to invisible in order to support multiple lines, since that property can't be set dynamically in VB. C++ deals with them a bit differently I think and thus 'should' be able to do this. I just don't know how to manage it. :p

Of course an alternative is to create the object in the script and 'pass' it to the form, but I have no clue if that would even work and suspect that it would cause the same problems with textboxes and the like as you find in Visual Basic. It would have been a whole lot easier if MS had provided a 'Form' control instead of assuming every person wanted or needed full document containers or complete programs to use controls. :p But then from a stand alone perspective it doesn't make sense for forms to be seperate objects form the program and with the web you are doing it all in a document anyway. No one has bothered to even consider the middle ground. :p

In any case.. Such a form could encapsulate all the code needed to add, display and handle events from the controls and to talk to the script and mushclient, so even if added directly into mushclient it could be generated as a semi-stand alone object that mushclient can create an instance of, but doesn't need to be integrated directly or cause the client to slow down. In theory at least...
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.


18,771 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.