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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  Plugin hanging client..

Plugin hanging client..

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


Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Fri 25 Oct 2002 01:58 AM (UTC)

Amended on Fri 25 Oct 2002 01:59 AM (UTC) by Shadowfyr

Message
Not sure if this is a mushclient bug or if not what is causing it. A recent plugin of mine (HitBar) which can be found at www.magnumsworld.com/muds is designed to provide a continueous change of colors as hit points, spell points and the mobs status changes. It worked great for about two days, then started causing the client to lock up every time the plugin was called. :p

After trying to reinstall the script engines without success, I finally removed the plugin and the client worked again. I can't see anything in the code I don't use any other place, so... I figure it was some sort of plugin ID bug or a glitch in the state files being saved for it. Changing the ID from "fba8f08ebbdd03bcae94ab05" to "fba8f08ebbdd03bcae94ab04", (seems) to have fixed it, at least for the first day I used it with the new ID. If it bugs again, then the state file may be at fault some how. I frankly can't think of any other reasons off hand for it to be hanging only after the client has reloaded it a second time. :p This is imho a potentially serious glitch...
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Fri 25 Oct 2002 06:04 AM (UTC)
Message
It is hard to know for sure what is happening here, and only being able to reproduce it every 2 days won't help. :)

Do you mean you have to restart the client when this happens, or do you get out of the "hang" some other way?

The things that might be wrong are:


  • Bug in the plugin (your code), eg. hanging on unusual data
  • Bug in the plugin that causes a gradual memory leak, which shows up after 2 days
  • Bug in VBscript, eg. gradual memory leak
  • Bug in MUSHclient, eg. gradual memory leak when calling a plugin


For instance, this code here I don't quite understand, could it loop indefinitely under some circumstances? ...


 do
    temp = world.getlineinfo(line,1)
    test = instr(temp,"HP: [")
    line = line - abs(test = 0)
  loop until test > 0


- Nick Gammon

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

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #2 on Fri 25 Oct 2002 06:54 PM (UTC)
Message
Hmm.. Well the code bit there is intended to make sure that the line I am getting the 'original' color for the bitbar from really is the correct line. It is intended to look backward through the buffer if the 'current' line is not the right one in order to find the line it needs the color from. Magnum pointed out this quirck in another thread, where the last line in the buffer may not actually be the one you are trying to recieve a style change from. This was my attempt at a fix, since there is no world.gettriggeredline or the like to be 100% certain you get the right one.

Interestingly.. The first instance of failure does happen with the very first line that triggers it. Why that line would A) not generate an immediate match or B) isn't in the buffer.. Note that 'line = line - abs(test - 0)' is a shortcut for 'if test = 0 then line = line - 1'. It shouldn't loop forever, but if it never find the line I need for some reason, then I suppose it could. :p

If this is the reason, then there has to be some reliable way to do this, but I can't think of one within musclients limitations. :p

As for the other possibilities you list:

1 : Not likely.. If it was then it would fail more often, since there is no effective difference between an installation while the client is running and when it first loads.. :p

2 - 3 : This would require the client to run continuously for 2 days straight right? Neither I nor the one other that has reported this does this.

It it quite likely the code snippet you pointed out that is responsible, which bugs me since it pretty well nukes the 'fix' I was atempting. :p
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #3 on Fri 25 Oct 2002 08:33 PM (UTC)

Amended on Fri 25 Oct 2002 08:35 PM (UTC) by Shadowfyr

Message
Confirmed.. The line I am trying to retrieve the colors from is not actually in the buffer to be retrieved the first time the trigger goes off.. This may be true in all cases as far as I can tell and thus any attempt to get the colors for the triggering line will not ever work. If so, then this is a serious problem, since it is the main reason for me, Magnum and possibly others to use it. :p

In any case, modifying the code to terminate if line = 0 and set the colors to "#C0C0C0" and "#000000" in response confirms that it fails to find the line the first time around and that was causing an infinite loop as you suggested.
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Fri 25 Oct 2002 09:07 PM (UTC)
Message
At least put in a simple loop breaker test.

eg.

count = count + 1

... and later ...

loop until test > 0 or count > 100

However my earlier suggestion should work. The triggered line should be the last, or second-last one in the output buffer (although if it is a multi-line paragraph) then you may need to move back a few more lines to find the start of the line, ie. the one after the previous one with the newline flag set.




- Nick Gammon

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

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #5 on Fri 25 Oct 2002 11:59 PM (UTC)

Amended on Sat 26 Oct 2002 12:07 AM (UTC) by Shadowfyr

Message
Sure move the thread. ;)

The problem definitely seems to have its origins in that it of code. However.. This is still a problem though and it makes no sense>

Triggering lines are all like:
HP: [300/1295] CONC: [1220/1400] OPPONENT: Wounded

Fixed function:

function GetHBCol()
  dim line, test, temp, output
  line = world.getlinesinbuffercount
  '** Should be the total number, including the trigger line.
  do
    '** Retrieve the full contents of the current (line).
    temp = world.getlineinfo(line,1)
    '** Should be 0 if not found or 1 or more if it is, i.e. TRUE is found.
    test = instr(temp,"HP: [")
    '** line should increment 'only' if the test is 0 i.e. false (this seems to be working).
    line = line - abs(test = 0)
    '** The fixed loop (note that if getlinesinbuffercount was accurate and included
    '** the trigger line, it should never reach 0).
  loop until test > 0 or line = 0
  if line = 0 then
    output = "#C0C0C0,#000000"
  else
    temp = world.getstyleinfo(line,1,14)
    output = world.RGBColourToName(temp)
    temp = world.getstyleinfo(line,1,15)
    output = "," & world.RGBColourToName(temp)
  end if
  GetHBCol = output
end function


The only thing I can think of it that the fact that the plugin gags the line it somehow effect whether the current line matches the instr function. If so, then it is still a problem. However if things where working right then either the 'current' or 'current - 1' line should be the trigger line. It will btw never actually wrap, so I should technically not need to look backward through the list. I have to do so, because when I tried to simply get the last line in the buffer and return it's colors (supposedly the line doing the triggering) I got "#C0C0C0,#000000", when the color should have been "Cyan,Black" on for my character. As far as I can tell it isn't returning the number of the line that is triggering and while I haven't checked the number returned by my search routine above, I suspect it must be doing the same thing each time, thus returning an earlier line that 'is' in the buffer. It simply should not have even tried to searched backwards if it was finding the current line where you say it should be.

Obviously for some reason you statement that "The triggered line should be the last, or second-last one in the output buffer.." is not true in this case. :p
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #6 on Sat 26 Oct 2002 06:38 PM (UTC)

Amended on Sat 26 Oct 2002 06:49 PM (UTC) by Shadowfyr

Message
Ok. Here is what actually gets generated in the plugin the first time:
hp
Line: 93
Contents: 
Line: 92
Contents: hp
Line: 91
Contents: [Ww-Hb-Mb-Bc-Sp-Sh-Ar-In-Sg-Sl-Pn]
Line: 90
Contents: The guard salutes Kagehi the Fabled defender of Loriah.
Line: 89
Contents: Sat Oct 26 21:52:26 2002 Ex = 5710>
Line: 88
Contents: 
Line: 87
Contents: Reboot timer set.
Line: 86
Contents: The next reboot is scheduled for 23:48 CEST (GMT+1) on Saturday (in 1h 55m 54s).
Line: 85
Contents: Ages of Despair has been up for 2d 4m 6s.
Line: 84
Contents: Sat Oct 26 21:52:26 2002 Ex = 5710>
Line: 83
Contents: Total of 36 users shown.
Line: 82
Contents: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Line: 81
Contents: [    5   ] Omicron the Novice
Line: 80
Contents: [   11   ] Desdamona the apprentice Healer
Line: 79
Contents: [   20   ] Prudis the Knave
Line: 78
Contents: [   25   ] Wieldo the Woodland mage initiate
Line: 77
Contents: [   26   ] Blackcrest the Walker of the Hallowed Path
Line: 76
Contents: [   30   ] Kirby the Watcher of the True [Idle]
Line: 75
Contents: [   31   ] Uriel the Preserver of Balance [Idle]
Line: 74
Contents: [   31   ] Anarchist the Preserver of Balance
Line: 73
Contents: [   33   ] Namsim the apprentice Adventurer
Line: 72
Contents: [   33   ] Edaj the apprentice Adventuress
Line: 71
Contents: [   35   ] Maevar the Follower of Hatred
Line: 70
Contents: [   35   ] Ann the Protector of the Ancient Forest
Line: 69
Contents: [   36   ] Enix the Protector of the Ancient Forest
Line: 68
Contents: [   40   ] Herbalist Saskatia the Guardian of the Oak Grove
Line: 67
Contents: [   44   ] Severus the Knifer
Line: 66
Contents: [   48   ] Fain the Cruel
Line: 65
Contents: [   50   ] Rene the Woodland Archmage
Line: 64
Contents: [   50   ] Bhardgast the Slayer of a Thousand Souls [Idle]
Line: 63
Contents: [   51   ] Lordrahl the Harmless
Line: 62
Contents: [   54   ] Chrono the Mental Dominator [Idle]
Line: 61
Contents: [   56   ] Lord Excalibur the Master of the Undead [Idle]
Line: 60
Contents: [   65   ] Tiphaine the Slayer of a Thousand Souls
Line: 59
Contents: [   66   ] Nosferatu the Treant
Line: 58
Contents: [   70   ] Bender the Mental Dominator [Idle]
Line: 57
Contents: [   71   ] Slick the Hobbit
Line: 56
Contents: [   75   ] Saruman the Harmless
Line: 55
Contents: [   83   ] Divine Usul of the Holy Order [Idle]
Line: 54
Contents: [   90   ] Blooth the Professional
Line: 53
Contents: [   102  ] Shadowfang the renowned Death Knight [Idle]
Line: 52
Contents: [   103  ] Horatio Swiftblade [Idle]
Line: 51
Contents: [   114  ] Robbie Fievr the lich
Line: 50
Contents: [   114  ] So I'm Eejit the "He's dead Jim" healer.
Line: 49
Contents: [   117  ] Alarielle the Cute little Faerie [Idle]
Line: 48
Contents: [   120  ] Byakko Kagehi - Inari no Kànnushi
Line: 47
Contents: [   136  ] Archdruid Tithian Lord of the Forest
Line: 46
Contents: [ Wizard ] Tristan the Apprentice Wizard [Idle]
Line: 45
Contents: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Line: 44
Contents: Ages of Despair [Sat Oct 26 21:52:26 2002]
Line: 43
Contents: Sat Oct 26 21:52:26 2002 Ex = 5710>
Line: 42
Contents: 
Line: 41
Contents: See also: help voting
Line: 40
Contents: 
Line: 39
Contents: and devoted player base AoD has!
Line: 38
Contents: to the mudding community, and let them know what a wonderful 
Line: 37
Contents: us on Kyndig as well. We'd really like to announce ourselves
Line: 36
Contents: when you vote, that you please make sure that you vote for 
Line: 35
Contents: that gets about 104,000+ hits per month. We encourage that
Line: 34
Contents: now listed with Kyndig.com, a popular mud related website
Line: 33
Contents: In order to help attract more people to our world, we are
Line: 32
Contents: 
Line: 31
Contents: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 
Line: 30
Contents:              - AoD's Message Of The Day -                     
Line: 29
Contents: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-   
Line: 28
Contents: Sat Oct 26 21:52:26 2002 Ex = 5710>
Line: 27
Contents: What ?
Line: 26
Contents: Sat Oct 26 21:52:26 2002 Ex = 5710>
Line: 25
Contents: Reconnected.
Line: 24
Contents: By what name do you wish to be known? Please enter your password: 
Line: 23
Contents: 
Line: 22
Contents: Ages of Despair is running the TMI-2 1.4alpha mudlib on MudOS v22.2b12
Line: 21
Contents: 
Line: 20
Contents:     Please login as Guest if you just want to look around.
Line: 19
Contents: 
Line: 18
Contents:  telnet://agesofdespair.org:5000 - http://www.agesofdespair.org
Line: 17
Contents: 
Line: 16
Contents:                           ..||  
Line: 15
Contents:                             ||                         
Line: 14
Contents:      .||...|' `|...  `...'  ||..|' `|..||. .||. .||.   
Line: 13
Contents:       ||   || ||..||  `'')  ||  || .|''||   ||   ||    
Line: 12
Contents:       ||   || .|''|, ('''' '||''|,  '''|.   ||  '||''| 
Line: 11
Contents:       ||   ||                               ''         
Line: 10
Contents:      '||'''|.             OF                             
Line: 9
Contents:                     `..|'              
Line: 8
Contents:                        ||                      V
Line: 7
Contents:      .//       \\. `|..|| `|...  `...'        /v\
Line: 6
Contents:        //     \\   ||  || ||..||  `'')     -<<<*>>>- 
Line: 5
Contents:         //...\\    .|''|, .|''|, (''''        \^/
Line: 4
Contents:          // \\                                 ^
Line: 3
Contents:           /.\                                       
Line: 2
Contents:                                              
Line: 1
Contents:     Welcome to the...
Line: 0
Contents: 


According to you line 93 'should' have been the matching line, but it is blank, so either the line is not yet in the buffer, or the gagging I did results in it coming up blank. In either case this is not good. The second time through it will start at 97 or whatever and count back to 93, where now the line 'is' available. So it is not working right. :p
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Sat 26 Oct 2002 09:46 PM (UTC)
Message
OK, I see what is happening here. :)

MUSHclient works like this when it gets a newline from the MUD ...


  1. Matches on triggers - adding matching triggers to a temporary list
  2. Logs line if requested
  3. Omits from output if requested
  4. Executes scripts found in step 1


The reason for deferring the script execution, is that if the script was executed and then the line was omitted from output, you would potentially have to omit lines which were no longer at the end of the buffer (because of world.notes). This is added complexity, because I want to remove from the end of the buffer, not somewhere in the middle.

Thus, if you omit from output, the line you matched on will not be there, hence the results you are seeing.

If you want the text of the matching line, that is supplied as part of the trigger subroutine call.

If you want the style of the matching line, then I don't have a simple solution (except to not omit it from output). If you only care about the very first style run, I suppose it could be memorised along with the trigger wildcards, to use in GetTriggerInfo, but that seems like putting in a special case to me. Any comments you have are welcome. :)

- Nick Gammon

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

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #8 on Sat 26 Oct 2002 10:08 PM (UTC)

Amended on Sat 26 Oct 2002 10:10 PM (UTC) by Shadowfyr

Message
Hmm. I figured this might be the case, that is why I suggested maybe Omit from output saving a copy in a temporary place, where the script can then retrieve all the same info. Otherwise this is annoying, because using it this way is what I and Magnum both want to do and imho is likely the use for which most people will be employing such lookups 90% of the time. Frankly at the moment I can't even think of any case where I would use style lookups and the like unless the intent was to omit the line. Otherwise who cares what the line styles are? You can't do anything with them once they are in the buffer anyway.
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Reply #9 on Mon 28 Oct 2002 03:37 AM (UTC)
Message
Heh... I'm just scanning the forums quickly due to withdraw... LOL. I'm pretty busy lately. Bought a new computer and it's taking a few days to get everything set up, plus I formatted c: on my old system, and I have to reinstall everything there too. Wow, this page looks so much different under Netscape 7 than it did under Netscape 4.7

Shadowfyr, I don't really have time to play around with the "Hitbar" plugin. If you want the site updated, I'm afraid you're gonna have to mail me the new version, even if you've only made subtle changes. Give me 3-4 days and maybe I can do it myself. In the process of this transition, I've lost access to all my old mail. Stupidly, Netscape 7 won't import my old mail/address book. :(

Regarding the most recent discussion here, I tend to agree with Shadowfyr to some extent. For my next project, I was planning to build script tools that would easily allow me to replace text in a line, while maintaining all of the font styles for that line. For example, if I want to insert comma's into a number, I want to capture the old line, omit it, then present a new line that retains all the formatting while replacing one or more substrings.

Actually, in my humble opinion, this is one feature that I wish was built into MUSHclient. Highlighting a word can be helpful at times, but equally useful would be the ability to replace a word.

Perhaps for now, the workaround would be to create multiple triggers:

Trigger: Grab the line
Sequence: 50
Purpose: Store the colour styles and text in variables.

Trigger: Omit the line
Sequence: 51
Purpose: The trigger omit's the line, the script sends a new line, using the data pulled by the first trigger.

I'll look into this more later, once I've settled into using this new 'puter...

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #10 on Mon 28 Oct 2002 08:37 AM (UTC)
Message
Quote:

Store the colour styles and text in variables.

...

The trigger omit's the line, the script sends a new line, using the data pulled by the first trigger.


Unfortunately this is the very thing that won't work, and using multiple triggers won't help.

As I said further up, it matches all triggers first, adding any matching ones to a temporary list. Then it omits from output if required. Then it executes all trigger scripts. Breaking it into two triggers won't make any difference.

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


75,453 views.

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 HostDash]