About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion Goto page Previous  1, 2, 3, 4  Next
Nattie Posted: Wed Aug 06, 2008 1:26 pm
Getting lots of strange "bugs" and errors, what are my options?
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Sep 03, 2008 5:04 pm   
 
Change the < character to "& lt ;" (without the quotes and without the spaces). The Forum is changing that entity back to a < character, but the XML for the CMUD import needs the original entity value.
It's one of the problems left with the CODE tag on the forum that I still need to fix when I get some time.

(So, copy it from the forum, paste it into Notepad, then edit any < and > character. Then copy the text from Notepad and paste it into CMUD).
Reply with quote
Nattie
Apprentice


Joined: 24 Jul 2008
Posts: 109

PostPosted: Wed Sep 03, 2008 5:15 pm   
 
Thank you; that fixed it. :-) I'm going to play around with it now.
Reply with quote
Nattie
Apprentice


Joined: 24 Jul 2008
Posts: 109

PostPosted: Wed Sep 03, 2008 5:35 pm   
 
I have two issues so far...

1. EDIT: Figured this one out. I have to do stuff like #CALL @queue("hum " @vocplay), got it.

2.
Quote:
@Queue("command",,"D") -- Informs the worker thread that command was completed


If I understand correctly, I need to have a trigger for every output of every possible command I could send to the game, so that when it receives that text from the game it knows it finished and it can remove the command from the queue? I guess I can do that if that's what it takes, but it's awfully... daunting. I'm not sure if other MUDs bother with this sort of thing, but DragonRealms tends to have tons and tons of possible outcomes for any command. So for example, if I just juggle something there's probably a dozen or more messages I could get back from the game for the action alone, plus more depending on what I'm juggling.

In practice I guess I'm making a lot of those results triggers anyway, though, so I'll give it a shot...

Thank you again for writing this. :-) I'll play around with it some more and see what else comes up.


Last edited by Nattie on Wed Sep 03, 2008 5:47 pm; edited 1 time in total
Reply with quote
Nattie
Apprentice


Joined: 24 Jul 2008
Posts: 109

PostPosted: Wed Sep 03, 2008 5:42 pm   
 
I thought of another thing related to #2...

#3. Some different commands result in the same output. For example, if I'm playing an instrument and want to stop I need to "stop play," and I get the message, "You stop playing your song." If I am humming and want to stop I need to "stop hum" and I get the same message. So if I have a "You stop playing your song." trigger I'm not sure what to do to make sure it removes the right thing. :-/

I'm not sure this is going to come up terribly often, at least, but it's one thing I thought of.
Reply with quote
Nattie
Apprentice


Joined: 24 Jul 2008
Posts: 109

PostPosted: Wed Sep 03, 2008 6:07 pm   
 
EDIT: Nevermind, think I figured this one out too.
Reply with quote
Nattie
Apprentice


Joined: 24 Jul 2008
Posts: 109

PostPosted: Wed Sep 03, 2008 6:41 pm   
 
Hmm, I'm getting all kinds of weird errors now. I thought maybe I'd corrupted the session so I exported it to XML, deleted it, and imported it, etc, but it's just acting really oddly. By that I mean I'm getting a lot of "Invalid pointer operation" errors. I would show a script debugger but I keep being forced to close the program and I can't get it in time.

Basically, what happens is this: I start the program and connect to the game. I do a #CALL @queue(,,"RESET") to get the thread started. I do zvocals. At this point, it's random how many commands it gets through before stopping. Last time it just did hum lament and stop hum. I received the messages for both, and the script debugger showed that the You stop playing your song. triggers had all triggered. The queue didn't send anything else to the game, though, which is weird because it should have a hum @vocplay in it. I checked the queue variables and it was nowhere to be found, even though the script debugger showed that #CALL @queue("hum " @vocplay) had been triggered after I stopped playing.

So I enter stop hum manually to see if it happens again. This triggers again and the queue gets it and sends it to the game properly, and keeps going properly for a few seconds when I get the pop-up error.

This is the entire contents of my test session:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<window name="Test" width="1280" height="905">
  <uid>{5BC5AB68-1BC4-4C4A-83D6-E269C5F58626}</uid>
  <packages>English Keypad|English Directions|Clickable URLs|Test</packages>
  <class name="vocals">
    <alias name="zvocals">
      <value>#CALL @queue("stop hum")

#IF (%1=="") {#T+ VocTriggers

#VAR vocset 0

#IF (@vocdiff<1) {#VAR vocdiff 1}

#VAR vocplay %db(@playdifficulty,@vocdiff)
#CALL @queue("hum " @vocplay)
}

#IF (%1=="end") {#T- VocMind; #T- VocTriggers;#VAR vocset 0}</value>
    </alias>
    <var name="vocdiff">10</var>
    <var name="vocplay">lament</var>
    <class name="VocTriggers">
      <trigger name="vocmessage3" priority="30360" case="true">
        <pattern>You begin to hum %w %w %w.$</pattern>
        <value>#ADD vocdiff 1
#CALL @queue("stop hum")</value>
      </trigger>
      <trigger name="vocmessage1" priority="30370" regex="true">
        <pattern>You effortlessly begin to hum [^\n]*, your heart swelling in pride at your hard-earned skill\.$</pattern>
        <value>#ADD vocdiff 1
#CALL @queue("stop hum")</value>
      </trigger>
      <trigger name="vocmessage2" priority="30380" regex="true">
        <pattern>You begin to hum [^\n]*, your skill in your craft showcased in every note\.$</pattern>
        <value>#ADD vocdiff 1
#CALL @queue("stop hum")</value>
      </trigger>
      <trigger name="vocmessage6" priority="30390" regex="true">
        <pattern>You begin to hum [^\n]* with only the slightest hint of difficulty\.$</pattern>
        <value>#ADD vocdiff 1
#CALL @queue("stop hum")</value>
      </trigger>
      <trigger name="vocmessage4" priority="30400" regex="true">
        <pattern>You fumble slightly as you begin to hum [^\n]*\.$</pattern>
        <value>#IF (@vocset=0) {#ADD vocdiff -1;#CALL @queue("stop hum")}</value>
      </trigger>
      <trigger name="vocmessage5" priority="30410" regex="true">
        <pattern>You struggle to begin to hum [^\n]*\.$</pattern>
        <value>#ADD vocdiff -1
#CALL @queue("stop hum")</value>
      </trigger>
      <trigger name="vocmessage7" priority="30390" regex="true">
        <pattern>You begin to hum [^\n]* with only the slightest hint of difficulty\.$</pattern>
        <value>#VAR vocset 1</value>
        <trigger regex="true">
          <pattern>You fumble slightly as you begin to hum [^\n]*\.$</pattern>
          <value>#ADD vocdiff -1
#VAR vocplay %db(@playdifficulty,@vocdiff)
#CALL @queue("stop hum")
#T+ VocMind
#CALL @queue("exp skill vocals")
#T- VocTriggers</value>
        </trigger>
      </trigger>
      <trigger priority="5850">
        <pattern>You stop playing your song.$</pattern>
        <value>#VAR vocplay %db(@playdifficulty,@vocdiff)
#CALL @queue("hum " @vocplay)</value>
      </trigger>
    </class>
    <class name="VocMind" enabled="false">
      <trigger name="vocmind1" priority="30450" regex="true">
        <pattern>Vocals:\s+\d+\s+\d+\.\d+%\s+(?:dazed|mind lock)</pattern>
        <value>#CALL @queue("exp skill vocals",,"D")
#CALL @queue("stop hum")
#WAIT 120000
#CALL @queue("exp skill vocals")</value>
      </trigger>
      <trigger name="vocmind2" priority="30480" regex="true">
        <pattern>Vocals:\s+\d+\s+\d+\.\d+%\s+(?:clear|learning|thoughtful|pondering|concentrating|muddled|perplex|bewilder|very)</pattern>
        <value>#CALL @queue("exp skill vocals",,"D")
#CALL @queue("hum " @vocplay)</value>
      </trigger>
      <trigger priority="30550" regex="true">
        <pattern>You finish humming [^\n]*\.$</pattern>
        <value>#CALL @queue("exp skill vocals")</value>
      </trigger>
      <trigger priority="5190">
        <pattern>You've gained a new rank in vocal instruments.</pattern>
        <value>zvocals</value>
      </trigger>
    </class>
    <var name="playdifficulty" type="Record">30=aria|31=sonata|32=concerto|10=lament|11=wedding|12=hymn|13=rumba|14=polka|15=battle|16=reel|17=elegy|18=serenade|19=minuet|1=scales|2=arpeggio|3=ditty|4=folk|5=ballad|6=waltz|7=lullaby|8=march|9=jig|20=psalm|21=dirge|22=gavotte|23=tango|24=tarantella|25=bolero|26=nocturne|27=requiem|28=fantasia|29=rondo</var>
    <var name="vocset">0</var>
    <trigger priority="290">
      <pattern>You stop playing your song.$</pattern>
      <value>#CALL @queue("stop hum",,"D")</value>
    </trigger>
    <trigger priority="300">
      <pattern>In the name of love</pattern>
      <value>#CALL @queue("stop hum",,"D")</value>
    </trigger>
    <trigger name="vocmessage1" priority="30370" regex="true">
      <pattern>You effortlessly begin to hum [^\n]*, your heart swelling in pride at your hard-earned skill\.$</pattern>
      <value>#CALL @queue("hum " @vocplay,,"D")</value>
    </trigger>
    <trigger name="vocmessage2" priority="30380" regex="true">
      <pattern>You begin to hum [^\n]*, your skill in your craft showcased in every note\.$</pattern>
      <value>#CALL @queue("hum " @vocplay,,"D")</value>
    </trigger>
    <trigger name="vocmessage3" priority="30360" case="true">
      <pattern>You begin to hum %w %w %w.$</pattern>
      <value>#CALL @queue("hum " @vocplay,,"D")</value>
    </trigger>
    <trigger name="vocmessage4" priority="30400" regex="true">
      <pattern>You fumble slightly as you begin to hum [^\n]*\.$</pattern>
      <value>#CALL @queue("hum " @vocplay,,"D")</value>
    </trigger>
    <trigger name="vocmessage5" priority="30410" regex="true">
      <pattern>You struggle to begin to hum [^\n]*\.$</pattern>
      <value>#CALL @queue("hum " @vocplay,,"D")</value>
    </trigger>
    <trigger name="vocmessage6" priority="30390" regex="true">
      <pattern>You begin to hum [^\n]* with only the slightest hint of difficulty\.$</pattern>
      <value>#CALL @queue("hum " @vocplay,,"D")</value>
    </trigger>
  </class>
  <class name="QueueSystem">
    <func name="Queue">
      <value><![CDATA[#LOCAL $RES
#SWITCH ($Action)
 ("D") {
  $Com=%item(@PendingCommands,1)
  #IF (%dbkeys($Com)=$Command) {
   #SECTION PD {
    #DELNITEM PendingCommands 1
    #IF (@PendingCommands="") {
     #IF (%threadname("QueueExecutorS")) {#SIGNAL RTPending 1}
    }
   }
  } {
   $Com=%item(@PendingCommands,2)
   #IF (%dbkeys($Com)=$Command) {
    #SECTION PD {
     PendingCommands=""
     #IF (%threadname("QueueExecutorS")) {#SIGNAL RTPending 1}
    }
   } {
    #SAY {Command $Command was not currently pending}
   }
  }
 }
 ("C") {
  $Count=1
  #SECTION QD {
   $Max=%numitems(@QueueData)
   #WHILE ($Count<=$Max) {
    #IF (%dbkeys(%item(@QueueData,$Count))=$Command) {
     #DELNITEM QueueData $Count
     $RES=%concat("Command ",$Count," canceled")
     $Count=$Max
    }
    $Count=($Count+1)
   }
  }
 }
 ("CA") {
  #SECTION QD {
   $QD=%subregex(@QueueData,%concat("(?:\A|\|)",$Command,"=[^|]*(?=\||\z)"),"(?(^)(?INSTANCE)�)")
   $RES=%concat(%word($QD,1,"�")," entries canceled")
   QueueData=%word($QD,2,"�")
  }
 }
 ("CL") {
  #SECTION QD {
   $Count=%numitems(@QueueData)
   #WHILE ($Count) {
    #IF (%dbkeys(%item(@QueueData,$Count))=$Command) {
     #DELNITEM QueueData $Count
     $RES=%concat("Command ",$Count," canceled")
     $Count=1
    }
    $Count=($Count-1)
   }
  }
 }
 ("RESET") {
  #STOP QueueExecutorS
  #STOP QueueExecutor
  #RESET QueueSystem
  #THREAD {QE} {QueueExecutor}
 } {
  #SECTION QD {
   #IF (@QueueData) {
    QueueData=%concat(@QueueData,"|",$Command,"=",$RT)
   } {
    QueueData=%concat($Command,"=",$RT)
   }
  }
  #IF ((%threadname("QueueExecutor")="")&&(%threadname("QueueExecutorS")="")) {
   #THREAD {QE} {QueueExecutor}
  }
  $RES="command added"
 }
#RESUME QueueExecutor
#RESUME QueueExecutor
#RETURN $RES]]></value>
      <arglist>$Command, $RT, $Action</arglist>
    </func>
    <var name="QueueData" type="StringList" usedef="true"/>
    <var name="PendingCommands" type="StringList" usedef="true"/>
    <alias name="QueueExecutor">
      <value>#IF (%threadname("QueueExecutor")) {#EXIT}
#IF (%threadname("QueueExecutorS")) {#EXIT}
#WAIT
#CALL %threadname(,"QueueExecutor")
#LOCAL $Command
#WHILE (1) {
 #IF (@QueueData) {
  #IF (%numitems(@PendingCommands)<2) {
   #SECTION QD {$Command=%pop(QueueData)}
   #SECTION PD {
    #IF (@PendingCommands) {
     PendingCommands=%concat(@PendingCommands,"|",$Command)
    } {
     PendingCommands=$Command
    }
   }
   #SEND {%dbkeys($Command)}
   #IF (%dbvalues($Command)) {
    #SIGNAL RTPending 0
    #CALL %threadname(,"QueueExecutorS")
    #WAITSIGNAL RTPending
    #CALL %threadname(,"QueueExecutor")
   }
  } {
   #SUSPEND QueueExecutor
  }
 } {
  #SUSPEND QueueExecutor
 }
 #IF (@RoundTime) {
  #WAIT (@RoundTime*1000)
  #SECTION RT {RoundTime=0}
 }
}</value>
    </alias>
    <var name="RoundTime" type="Integer" usedef="true">
      <value>0</value>
      <default>0</default>
    </var>
    <trigger priority="70">
      <pattern>Roundtime(?:\:)?\s+(\d(?:\d)*)</pattern>
      <value>#SECTION RT {
 RoundTime=%1
}
#SIGNAL RTPending 1</value>
    </trigger>
  </class>
</window>
</cmud>
Reply with quote
Nattie
Apprentice


Joined: 24 Jul 2008
Posts: 109

PostPosted: Wed Sep 03, 2008 6:45 pm   
 
Also, a couple times now I've closed CMUD, opened it again, did the #CALL @queue(,,"RESET"), and then tried to do zvocals and the program has just outright froze. :-/

EDIT: Actually, that's all it will do anymore. I'm not sure why.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Sep 03, 2008 7:30 pm   
 
Hrm. I only spent a couple of hours testing offline when I got up 3:30 this morning. For the most part the usage of the queue is meant for things where you need to launch a whole series of commands and have them play out in order, while dealing with both the roundtime and 2 command limitations from the mud. Your vocal system of triggers doesn't really need the queue, but it seems a good practice test bed. I don't think I will have enough time to really play with it tonight to find out what the problem is, but it will be at the top of my list for tommorrow morning and night.

Also you don't actually have to do a RESET with the queue when you first launch. It detects that the worker thread is not running and starts it with the first addition. The variables all use a default value for speed and that default is what they will contain when you first launch. You might want to do a RESET when you are disconnected from the mud so that you ensure a clean slate when reconnected, but that depends on how you play.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Nattie
Apprentice


Joined: 24 Jul 2008
Posts: 109

PostPosted: Wed Sep 03, 2008 7:46 pm   
 
Vijilante wrote:
Hrm. I only spent a couple of hours testing offline when I got up 3:30 this morning. For the most part the usage of the queue is meant for things where you need to launch a whole series of commands and have them play out in order, while dealing with both the roundtime and 2 command limitations from the mud. Your vocal system of triggers doesn't really need the queue


For the stuff I have in mind, everything needs to use the queue so I never try to send a command while I'm in RT, and so that it never tries to send too many commands at once. So, for example I could just use #SEND for the vocals stuff, but the vocals script is something that runs while other scripts are running and I would quickly run into "you can't type that many lines ahead" problems. The reason I figured I should keep using vocals as the test script is because it's something I will nearly always be running in the background as other scripts run. (Humming is one of the few skills you can perform even while doing other actions, so it makes sense to be humming all the time, even if you're disarming boxes or juggling or reading or foraging... and so on. Just about the only two things I can't do while humming is fight monsters and cast spells, so those scripts always do a zvocals end when they start and a zvocals when they finish.)

My vision is that, eventually, I would be able to run a simple script to get things started, and CMUD would then determine what scripts to run on its own so I can leave it unattended for stretches of time. (DragonRealms makes a special version of the game where there is no AFK policy.) That's one of my main motivations for using CMUD, so I can't see any way around using the queue for everything. It shouldn't be a problem, though, will it?

Vijilante wrote:
Also you don't actually have to do a RESET with the queue when you first launch. It detects that the worker thread is not running and starts it with the first addition.


Ah, that's weird... the reason I was doing the reset on start-up was because it wasn't starting the thread or doing anything when I'd launch a call for it. So, for example, I would start CMUD, do a #THREAD, see the usual 1 thread running, and then do zvocals. Nothing would happen. I'd type #THREAD and nothing would be there. If I did a reset it would launch the thread, though. I tested this a few times and it always did the same thing, so I chalked it up to my misunderstanding and just used the RESET since it worked.

Now I just tested again and it *did* start up correctly, but it freezes still after sending a few commands. I'm going to mess with my triggers and see if something is up there.

Thanks again for all your help, once I figure out what's going on I think this will be pretty much exactly what I need. :-)
Reply with quote
Nattie
Apprentice


Joined: 24 Jul 2008
Posts: 109

PostPosted: Thu Sep 04, 2008 12:51 am   
 
I tried opening CMUD again and testing things, and it didn't crash this time. I'm not sure what gets it into that state, but I have restarted the computer since then so maybe that cleaned out some weirdness.

Anyway, the weirdest thing I have happen in CMUD --and this happened even before either queue -- is that triggers will sometimes trigger twice off the same line. I caught it in the script debugger... It happens a lot with the "You finish humming" line, for some reason. It's not set up to trigger multiple times off the same line, either.

Code:
       | ---
0.0006 | c      Test |  [1] Test Comline : start :
0.0012 | k      Test |    [QueueExecutor] Var "QueueData" changed from "stop hum=" to ""
0.0002 | k      Test |    [1] Var "vocplay" changed from "lament" to "wedding"
0.0009 | a      Test |> stop hum
0.0016 | j      Test >stop hum
0.0002 | d      Test |  [1] Test Comline : stopped
0.0192 | k      Test |  [QueueExecutor] Var "QueueData" changed from "hum wedding=" to ""
0.0244 | a      Test |hum wedding
0.0016 | j      Test >hum wedding
0.1759 | a      Test |
0.0223 | a      Test |In the name of love?
0.0002 | f      Test |  Pattern: In the name of love
0.0007 | c      Test |  exec : Pattern "In the name of love" : #CALL @queue("stop hum",,...
0.0004 | k      Test |  Var "PendingCommands" changed from "stop hum=|hum wedding=" to "hum wedding="
0.0012 | a      Test ]>
0.3211 | a      Test |>
0.0011 | a      Test |You fumble slightly as you begin to hum a quiet wedding march.
0.0007 | f      Test |  Pattern: You fumble slightly as you begin to hum [^\n]*\.$
0.0017 | c      Test |  exec : Pattern "You fumble slightly as you begin to hum [^\n]*\....
0.0003 | k      Test |  Var "vocdiff" changed from "11" to "10"
0.0002 | k      Test |  Var "vocplay" changed from "wedding" to "lament"
0.0019 | f      Test |  Pattern: You fumble slightly as you begin to hum [^\n]*\.$
0.0011 | c      Test |  exec : Pattern "vocmessage4" : #CALL @queue("hum " @vocplay,,"D")
0.0203 | a      Test |Command hum lament was not currently pending
0.0220 | f      Test |  Pattern: You fumble slightly as you begin to hum [^\n]*\.$
0.0007 | c      Test |  exec : Pattern "vocmessage4" : #CALL @queue("hum " @vocplay,,"D")
0.0008 | a      Test |Command hum lament was not currently pending
0.0008 | k      Test |  [QueueExecutor] Var "QueueData" changed from "stop hum=|exp skill vocals=" to "exp skill vocals="
0.0009 | a      Test ]>
0.0023 | a      Test |> stop hum
0.0017 | j      Test >stop hum
0.2017 | a      Test |
0.0006 | a      Test |You stop playing your song.
0.0002 | f      Test |  Pattern: You stop playing your song.$
0.0006 | c      Test |  exec : Pattern "You stop playing your song.$" : #CALL @queue("st...
0.0012 | k      Test |  [QueueExecutor] Var "QueueData" changed from "exp skill vocals=" to ""
0.0009 | a      Test |exp skill vocals
0.0209 | j      Test >exp skill vocals
0.0224 | a      Test ]>
0.1992 | a      Test |>
0.0005 | a      Test |Showing Vocals experience:
0.0004 | a      Test |
0.0004 | a      Test |          SKILL: Rank/Percent towards next rank/Amount learning
0.0004 | a      Test |          Vocals:     86 87.37% muddled     
0.0002 | f      Test |  Pattern: Vocals:\s+\d+\s+\d+\.\d+%\s+(?:clear|learning|thoughtful|...
0.0008 | c      Test |  exec : Pattern "vocmind2" : #CALL @queue("exp skill vocals",,"D"...
0.0003 | k      Test |  Var "PendingCommands" changed from "exp skill vocals=" to ""
0.0238 | k      Test |  [QueueExecutor] Var "QueueData" changed from "hum lament=" to ""
0.0004 | a      Test |
0.0006 | a      Test |hum lament
0.0003 | j      Test >hum lament
0.0005 | a      Test |Time Development Points: 23  Favors: 7  Deaths: 0
0.0005 | a      Test |Overall state of mind: clear
0.0004 | a      Test |EXP HELP for more information
0.0188 | a      Test ]>
0.2682 | a      Test |>
0.0005 | a      Test |You begin to hum a quiet lament with only the slightest hint of difficulty.
0.0002 | f      Test |  Pattern: You begin to hum [^\n]* with only the slightest hint of d...
0.0001 | c      Test |  exec : Pattern "vocmessage6" : #CALL @queue("hum " @vocplay,,"D")
0.0003 | k      Test |  Var "PendingCommands" changed from "hum lament=" to ""
0.0011 | a      Test ]>
14.409 | a      Test |>
0.0008 | f      Test |  Pattern: You begin to hum [^\n]* with only the slightest hint of d...
0.0001 | c      Test |  exec : Pattern "vocmessage6" : #CALL @queue("hum " @vocplay,,"D")
0.0007 | a      Test |Command hum lament was not currently pending
0.0009 | a      Test |You continue to hum your song.
0.0008 | a      Test |
0.0021 | a      Test ]>
16.001 | a      Test |>
0.0005 | a      Test |You continue to hum a quiet lament with only the slightest hint of difficulty.
0.0058 | a      Test |
0.0190 | a      Test ]>
16.007 | a      Test |>
0.0004 | a      Test |You continue to hum your song.
0.0007 | a      Test |
0.0026 | a      Test ]>
15.995 | a      Test |>
0.0005 | a      Test |You continue to hum a quiet lament with only the slightest hint of difficulty.
0.0044 | a      Test |
0.0018 | a      Test ]>
15.975 | a      Test |>
0.0005 | a      Test |You continue to hum your song.
0.0023 | a      Test |
0.0228 | a      Test ]>
15.978 | a      Test |>
0.0005 | a      Test |You continue to hum a quiet lament with only the slightest hint of difficulty.
0.0054 | a      Test |
0.0194 | a      Test ]>
16.017 | a      Test |>
0.0004 | a      Test |You continue to hum your song.
0.0024 | a      Test |
0.0200 | a      Test ]>
2.0922 | a      Test |>
0.0005 | a      Test |A worker enters pushing a wheelbarrow.  He dumps everything in the bin into his wheelbarrow and begins to pick through the items....
0.0176 | a      Test |
0.0012 | a      Test |Having found nothing of interest to keep or save, he leaves again.
0.0258 | a      Test ]>
13.942 | a      Test |>
0.0004 | a      Test |You finish humming a quiet lament.
0.0001 | f      Test |  Pattern: You finish humming [^\n]*\.$
0.0008 | c      Test |  exec : Pattern "You finish humming [^\n]*\.$" : #CALL @queue("ex...
0.0009 | k      Test |  [QueueExecutor] Var "QueueData" changed from "exp skill vocals=" to ""
0.0003 | a      Test |
0.0001 | f      Test |  Pattern: You finish humming [^\n]*\.$
0.0208 | c      Test |  exec : Pattern "You finish humming [^\n]*\.$" : #CALL @queue("ex...
0.0240 | a      Test |exp skill vocals
0.0003 | j      Test >exp skill vocals
0.0006 | k      Test |  [QueueExecutor] Var "QueueData" changed from "exp skill vocals=" to ""
0.0008 | a      Test |exp skill vocals
0.0002 | j      Test >exp skill vocals
0.0007 | a      Test ]>
0.2621 | a      Test |>
0.0210 | a      Test |Showing Vocals experience:
0.0004 | a      Test |
0.0004 | a      Test |          SKILL: Rank/Percent towards next rank/Amount learning
0.0004 | a      Test |          Vocals:     86 88.45% very muddled
0.0001 | f      Test |  Pattern: Vocals:\s+\d+\s+\d+\.\d+%\s+(?:clear|learning|thoughtful|...
0.0003 | c      Test |  exec : Pattern "vocmind2" : #CALL @queue("exp skill vocals",,"D"...
0.0003 | k      Test |  Var "PendingCommands" changed from "exp skill vocals=|exp skill vocals=" to "exp skill vocals="
0.0024 | k      Test |  [QueueExecutor] Var "QueueData" changed from "hum lament=" to ""
0.0004 | a      Test |
0.0006 | a      Test |hum lament
0.0002 | j      Test >hum lament
0.0005 | a      Test |Time Development Points: 23  Favors: 7  Deaths: 0
0.0004 | a      Test |Overall state of mind: clear
0.0004 | a      Test |EXP HELP for more information
0.0024 | a      Test ]>
0.0891 | a      Test |>
0.0004 | a      Test |Showing Vocals experience:
0.0004 | a      Test |
0.0210 | a      Test |          SKILL: Rank/Percent towards next rank/Amount learning
0.0006 | a      Test |          Vocals:     86 88.45% very muddled
0.0001 | f      Test |  Pattern: Vocals:\s+\d+\s+\d+\.\d+%\s+(?:clear|learning|thoughtful|...
0.0003 | c      Test |  exec : Pattern "vocmind2" : #CALL @queue("exp skill vocals",,"D"...
0.0003 | k      Test |  Var "PendingCommands" changed from "exp skill vocals=|hum lament=" to "hum lament="
0.0238 | k      Test |  [QueueExecutor] Var "QueueData" changed from "hum lament=" to ""
0.0004 | a      Test |
0.0006 | a      Test |hum lament
0.0002 | j      Test >hum lament
0.0005 | a      Test |Time Development Points: 23  Favors: 7  Deaths: 0
0.0004 | a      Test |Overall state of mind: clear
0.0004 | a      Test |EXP HELP for more information
0.0189 | a      Test ]>
0.1364 | a      Test |>
0.0005 | a      Test |You begin to hum a quiet lament with only the slightest hint of difficulty.
0.0001 | f      Test |  Pattern: You begin to hum [^\n]* with only the slightest hint of d...
0.0001 | c      Test |  exec : Pattern "vocmessage6" : #CALL @queue("hum " @vocplay,,"D")
0.0003 | k      Test |  Var "PendingCommands" changed from "hum lament=|hum lament=" to "hum lament="
0.0203 | a      Test ]>
0.3173 | a      Test |>
0.0002 | f      Test |  Pattern: You begin to hum [^\n]* with only the slightest hint of d...
0.0001 | c      Test |  exec : Pattern "vocmessage6" : #CALL @queue("hum " @vocplay,,"D")
0.0003 | k      Test |  Var "PendingCommands" changed from "hum lament=" to ""
0.0008 | a      Test |You are already performing something.  You should stop that first.
0.0008 | a      Test ]>
15.153 | a      Test |>
0.0004 | a      Test |You continue to hum your song.
0.0021 | a      Test |
0.0202 | a      Test ]>
15.991 | a      Test |>
0.0005 | a      Test |You continue to hum a quiet lament with only the slightest hint of difficulty.
0.0040 | a      Test |
0.0026 | a      Test ]>
0.0000 |
Reply with quote
Nattie
Apprentice


Joined: 24 Jul 2008
Posts: 109

PostPosted: Thu Sep 04, 2008 1:01 am   
 
Not sure if this is any more helpful, but a little more information about things triggering twice:

1. It happens about 75% of the time (rough estimate) on that "You finish humming" line. To reiterate, there is only one trigger with that pattern, and is not set to trigger twice within the same line or anything. It's in the big paste of the entire session I put up earlier, but for the sake of simplicity here it is alone:

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="30550" regex="true" copy="yes">
    <pattern>You finish humming [^\n]*\.$</pattern>
    <value>#CALL @queue("exp skill vocals")</value>
  </trigger>
</cmud>


Is it something about the REGEX used there, maybe?

2. I turned on most of the script debugger messages and caught it again. I don't know if the extra messages will be helpful, but just in case:

Code:
0.0013 | a      Test |You finish humming a quiet lament.
0.0010 | f      Test |  Pattern: You finish humming [^\n]*\.$
0.0013 | c      Test |  exec : Pattern "You finish humming [^\n]*\.$" : #CALL @queue("ex...
0.0030 | n      Test |  Exec Trigger "You finish humming [^\n]*\.$"
0.0006 | n      Test |  Exec Func "Queue"
0.0208 | k      Test |  [QueueExecutor] Var "QueueData" changed from "exp skill vocals=" to ""
0.0036 | a      Test |
0.0236 | f      Test |  Pattern: You finish humming [^\n]*\.$
0.0013 | c      Test |  exec : Pattern "You finish humming [^\n]*\.$" : #CALL @queue("ex...
0.0007 | n      Test |  Exec Trigger "You finish humming [^\n]*\.$"
0.0219 | n      Test |  Exec Func "Queue"
0.0016 | a      Test |exp skill vocals
0.0237 | j      Test >exp skill vocals
0.0026 | k      Test |  [QueueExecutor] Var "QueueData" changed from "exp skill vocals=" to ""
0.0017 | a      Test |exp skill vocals
0.0214 | j      Test >exp skill vocals
0.0015 | a      Test ]>
0.2024 | a      Test |>
0.0013 | a      Test |Showing Vocals experience:
0.0011 | a      Test |
0.0012 | a      Test |          SKILL: Rank/Percent towards next rank/Amount learning
0.0017 | a      Test |          Vocals:     86 96.40% mind lock   
0.0008 | f      Test |  Pattern: Vocals:\s+\d+\s+\d+\.\d+%\s+(?:dazed|mind lock)
0.0016 | c      Test |  [7] Test Trigger : start : Pattern "vocmind1" : #CALL @queue("exp skill vocals",,"D"...
0.0014 | n      Test |    Exec Func "Queue"
0.0009 | k      Test |    [7] Var "PendingCommands" changed from "exp skill vocals=|exp skill vocals=" to "exp skill vocals="
0.0009 | n      Test |    Exec Func "Queue"
0.0217 | d      Test |    [7] Test Trigger : wait 118465 ms
0.0250 | k      Test |    [QueueExecutor] Var "QueueData" changed from "stop hum=" to ""
0.0214 | a      Test |
0.0013 | a      Test |stop hum
0.0009 | j      Test >stop hum
0.0010 | a      Test |Time Development Points: 23  Favors: 7  Deaths: 0
0.0240 | a      Test |Overall state of mind: fluid
0.0012 | a      Test |EXP HELP for more information
0.0030 | a      Test ]>
0.1190 | a      Test |>
0.0202 | a      Test |Showing Vocals experience:
0.0011 | a      Test |
0.0241 | a      Test |          SKILL: Rank/Percent towards next rank/Amount learning
0.0213 | a      Test |          Vocals:     86 96.40% mind lock   
0.0007 | f      Test |    Pattern: Vocals:\s+\d+\s+\d+\.\d+%\s+(?:dazed|mind lock)
0.0016 | c      Test |    [8] Test Trigger : start : Pattern "vocmind1" : #CALL @queue("exp skill vocals",,"D"...
0.0014 | n      Test |      Exec Func "Queue"
0.0010 | k      Test |      [8] Var "PendingCommands" changed from "exp skill vocals=|stop hum=" to "stop hum="
0.0238 | n      Test |      Exec Func "Queue"
0.0216 | d      Test |      [8] Test Trigger : wait 118471 ms
0.0024 | k      Test |      [QueueExecutor] Var "QueueData" changed from "stop hum=" to ""
0.0240 | a      Test |
0.0013 | a      Test |stop hum
0.0010 | j      Test >stop hum
0.0011 | a      Test |Time Development Points: 23  Favors: 7  Deaths: 0
0.0012 | a      Test |Overall state of mind: fluid
0.0011 | a      Test |EXP HELP for more information
0.0031 | a      Test ]>
0.0860 | a      Test |>
0.0013 | a      Test |In the name of love?
0.0007 | f      Test |      Pattern: In the name of love
0.0210 | c      Test |      exec : Pattern "In the name of love" : #CALL @queue("stop hum",,...
0.0007 | n      Test |      Exec Trigger "In the name of love"
0.0235 | n      Test |      Exec Func "Queue"
0.0008 | k      Test |      Var "PendingCommands" changed from "stop hum=|stop hum=" to "stop hum="
0.0019 | a      Test ]>
0.3554 | a      Test |>
0.0016 | a      Test |In the name of love?
0.0008 | f      Test |      Pattern: In the name of love
0.0012 | c      Test |      exec : Pattern "In the name of love" : #CALL @queue("stop hum",,...
0.0007 | n      Test |      Exec Trigger "In the name of love"
0.0006 | n      Test |      Exec Func "Queue"
0.0008 | k      Test |      Var "PendingCommands" changed from "stop hum=" to ""
0.0018 | a      Test ]>
5.4088 | a      Test |>
Reply with quote
Nattie
Apprentice


Joined: 24 Jul 2008
Posts: 109

PostPosted: Thu Sep 04, 2008 7:00 am   
 
I caught an example of the queue not sending commands if the thread is not already running, i.e. if I start up the program and just run zvocals first. During the same session, I caught an example of something that makes it error.

Here is the script debugger. I enter #THREAD, and then zvocals from the command line:
Code:
       | ---
0.0006 | c      Test |  [1] Test Comline : start :
0.0477 | a      Test |> Threads:
0.0020 | a      Test |  #   ID         Window Name          Status               Script
0.0017 | a      Test |  -------------------------------------------------------------------------------------------------
0.0507 | a      Test |  1              [u] Test             running             
0.0016 | d      Test |  [1] Test Comline : stopped
1.2771 | a      Test ]>
1.8881 | ---
0.0004 | c      Test |  [1] Test Comline : start :
0.0021 | l      Test |    Alias "zvocals" compiled (Normal) : #CALL @queue("stop hum")  #IF (%1=="") {#T+ VocTriggers  ...
0.0001 | n      Test |    Exec Alias "zvocals"
0.0420 | l      Test |    Func "Queue" compiled (Normal) : #LOCAL $RES #SWITCH ($Action)  ("D") {   $Com=%item(@Pend...
0.0002 | n      Test |    Exec Func "Queue"
0.0495 | c      Test |    [QE]  : start : Compiled #THREAD command
0.0477 | n      Test |      Exec Func "Queue"
0.0007 | c      Test |      [QE]  : start : Compiled #THREAD command
0.0501 | d      Test |      [1] Test Comline : stopped
0.0044 | d      Test |      [QE]  : terminated
0.0002 | d      Test |    [QE]  : terminated
5.1729 | ---


I see on a status bar that the variables have changed to include the commands, but the commands are not sent to the game. I do a #THREAD:

Code:
0.0003 | c      Test |  [1] Test Comline : start :
0.0477 | a      Test |> Threads:
0.0510 | a      Test |  #   ID         Window Name          Status               Script
0.0017 | a      Test |  -------------------------------------------------------------------------------------------------
0.0017 | a      Test |  1              [u] Test             running             
0.0015 | d      Test |  [1] Test Comline : stopped
8.8964 | a      Test ]>
18.109 | ---


The thread was never initialized. I do a #CALL @queue(,,"RESET") and things get really weird:
Code:
0.0005 | c      Test |  [1] Test Comline : start :
0.0006 | n      Test |    Exec Func "Queue"
0.0010 | a      Test |> QueueSystem reset to its startup value
0.0007 | l      Test |    Trigger "vocmessage0" compiled (Pattern) : You stop playing your song.$
0.0003 | l      Test |    Trigger "vocmessage3" compiled (Pattern) : You begin to hum %w %w %w.$
0.0005 | l      Test |    Trigger "vocmessage1" compiled (RegEx) : You effortlessly begin to hum [^\n]*, your heart swelling...
0.0004 | l      Test |    Trigger "vocmessage2" compiled (RegEx) : You begin to hum [^\n]*, your skill in your craft showcas...
0.0004 | l      Test |    Trigger "vocmessage6" compiled (RegEx) : You begin to hum [^\n]* with only the slightest hint of d...
0.0004 | l      Test |    Trigger "vocmessage7" compiled (RegEx) : You begin to hum [^\n]* with only the slightest hint of d...
0.0003 | l      Test |    Trigger "vocmessage4" compiled (RegEx) : You fumble slightly as you begin to hum [^\n]*\.$
0.0003 | l      Test |    Trigger "vocmessage5" compiled (RegEx) : You struggle to begin to hum [^\n]*\.$
0.0473 | c      Test |    [QE]  : start : Compiled #THREAD command


When I hit enter on the #CALL @queue(,,"RESET") I got the following error: "Access violation at address 009F2E64 in module 'cMUD.exe'. Read of address 00000034."

I tried to send the bug report and it did the little connecting bar, but it said sorry, it couldn't send it. I saved the bug report, fwiw.

To be clear, this is everything I ever entered in the session, and everything I got back. There is a bit of log-in spam from the game missing from when it first connected and I had not yet opened the script debugger, but that's it.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Sep 04, 2008 5:02 pm   
 
Nattie sent me the crash dump for this. The crash was in the routine that tries to display a timestamp value. All I can think of is that the script debugger window was trying to update itself from another thread somehow.
So it's possible this particular crash was from the script debugger window and not her script. But it was a weird crash dump and a bit hard to interpret.
The access violation happened on a line where both objects had already been tested for being "nil" which means the pointers were actually corrupted rather than just being nil.
Reply with quote
Nattie
Apprentice


Joined: 24 Jul 2008
Posts: 109

PostPosted: Thu Sep 04, 2008 8:12 pm   
 
Hah, that's actually pretty funny; I had gotten really diligent about using the script debugger before testing anything, so I think I used it pretty much every session before typing anything.

I just opened my test session, did not open the script debugger, and the queue appears to work perfectly. Laughing I'll mess with it some more and start converting other scripts. :-) I'll post anything else weird that happens.

Thanks very much to both of you!
Reply with quote
Nattie
Apprentice


Joined: 24 Jul 2008
Posts: 109

PostPosted: Thu Sep 04, 2008 9:55 pm   
 
I tried testing the queue with a script that has commands that have an RT. One thing I noticed is that the RoundTime trigger wasn't set to #REGEX so I fixed that real quick.

It doesn't seem to detect the RT fast enough, though, even with the 100ms wait trigger state before sending the "done" command. So instead of having it wait 100ms, I have the state be REGEX and the condition be "Roundtime(?:\:)?\s+(\d(?:\d)*)" to send the done command. So far it works mostly beautifully. :D It still sends the done command too fast sometimes, which is puzzling to me, though. It also hangs sometimes. I'm going to keep testing and try to give more specific examples.
Reply with quote
Nattie
Apprentice


Joined: 24 Jul 2008
Posts: 109

PostPosted: Thu Sep 04, 2008 10:25 pm   
 
Okay, what seems to be happening is that sometimes there are commands in @QueueData and nothing in @PendingCommands. I tested this with zvocals where there is no roundtime associated with anything. I tried running zvocals again while it was hung, and this flushed the queue out properly. Another time this happened running zvocals just added more stuff to the queue without prompting it to empty itself. Trying to type it again right after made it work.
Reply with quote
Nattie
Apprentice


Joined: 24 Jul 2008
Posts: 109

PostPosted: Thu Sep 04, 2008 10:32 pm   
 
I'm still getting things triggering off "You finish humming" twice. :-/
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Sep 04, 2008 10:33 pm   
 
I have added the problem with the script debugger when using a #THREAD command to the bug list. Hopefully I can figure out what's causing that crash with all of your info.

When looking at your latest script, I also saw stuff like this:
Code:
   #SECTION PD {
    #DELNITEM PendingCommands 1
    #IF (@PendingCommands="") {
     #IF (%threadname("QueueExecutorS")) {#SIGNAL RTPending 1}
    }

When using #SECTION, it is *very important* to minimize the amount of code within the section. In particular, you should *never* do anything that might cause the script to branch to another script in the middle of the section.
In your case, you are calling #SIGNAL from inside the #SECTION. The #SIGNAL command will start running anything that is currently waiting on that signal, causing your section to remain locked.
This kind of branching out of a section can lead to a section lock which can completely hang CMUD. So I'd change your code to:
Code:
#SECTION PD {#DELNITEM PendingCommands 1}
#IF (@PendingCommands="") {
#IF (%threadname("QueueExecutorS")) {#SIGNAL RTPending 1}

It's only when you *change* a global variable (like with #DELNITEM, or #ADDITEM, etc) that you need a #SECTION. Just reading from the variable, like with @PendingCommands doesn't need the section.
If you find that you have a case where you need to also read the variable within the section, then you can try something like this:
Code:
#LOCAL $Pending
#SECTION PD {
    #DELNITEM PendingCommands 1
    $Pending = @PendingCommands
    }
#IF ($Pending="") {
    #IF (%threadname("QueueExecutorS")) {#SIGNAL RTPending 1}
    }

Again, ensuring that you don't cause any branching while you are in the protected section.
Reply with quote
Nattie
Apprentice


Joined: 24 Jul 2008
Posts: 109

PostPosted: Fri Sep 05, 2008 6:12 am   
 
Thank you! I changed the alias QueueExecutor to this:

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <alias name="QueueExecutor" copy="yes">
    <value>#IF (%threadname("QueueExecutor")) {#EXIT}
#IF (%threadname("QueueExecutorS")) {#EXIT}
#WAIT
#CALL %threadname(,"QueueExecutor")
#LOCAL $Command
#WHILE (1) {
 #IF (@QueueData) {
  #IF (%numitems(@PendingCommands)<2) {
   #SECTION QD {$Command=%pop(QueueData)}
   #IF (@PendingCommands) {
      #SECTION PD {PendingCommands=%concat(@PendingCommands,"|",$Command)}
    } {#SECTION PD {PendingCommands=$Command}}
   
   #SEND {%dbkeys($Command)}
   #IF (%dbvalues($Command)) {
    #SIGNAL RTPending 0
    #CALL %threadname(,"QueueExecutorS")
    #WAITSIGNAL RTPending
    #CALL %threadname(,"QueueExecutor")
   }
  } {
   #SUSPEND QueueExecutor
  }
 } {
  #SUSPEND QueueExecutor
 }
 #IF (@RoundTime) {
  #WAIT (@RoundTime*1000+1000)
  #SECTION RT {RoundTime=0}
 }
}</value>
  </alias>
</cmud>


(I added an extra second onto the RT wait because often enough, the game server lags a little and I get a "wait 1 seconds" message returned.)

And I changed the function Queue slightly to this:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <func name="Queue" copy="yes">
    <value><![CDATA[#LOCAL $RES
#SWITCH ($Action)
 ("D") {
  $Com=%item(@PendingCommands,1)
  #IF (%dbkeys($Com)=$Command) {
   #SECTION PD {#DELNITEM PendingCommands 1}
    #IF (@PendingCommands="") {
     #IF (%threadname("QueueExecutorS")) {#SIGNAL RTPending 1}
    }
   
  } {
   $Com=%item(@PendingCommands,2)
   #IF (%dbkeys($Com)=$Command) {
    #SECTION PD {PendingCommands=""}
     #IF (%threadname("QueueExecutorS")) {#SIGNAL RTPending 1}
   
   } {
    #SAY {Command $Command was not currently pending}
   }
  }
 }
 ("C") {
  $Count=1
  #SECTION QD {
   $Max=%numitems(@QueueData)
   #WHILE ($Count<=$Max) {
    #IF (%dbkeys(%item(@QueueData,$Count))=$Command) {
     #DELNITEM QueueData $Count
     $RES=%concat("Command ",$Count," canceled")
     $Count=$Max
    }
    $Count=($Count+1)
   }
  }
 }
 ("CA") {
  #SECTION QD {
   $QD=%subregex(@QueueData,%concat("(?:\A|\|)",$Command,"=[^|]*(?=\||\z)"),"(?(^)(?INSTANCE)�)")
   $RES=%concat(%word($QD,1,"�")," entries canceled")
   QueueData=%word($QD,2,"�")
  }
 }
 ("CL") {
  #SECTION QD {
   $Count=%numitems(@QueueData)
   #WHILE ($Count) {
    #IF (%dbkeys(%item(@QueueData,$Count))=$Command) {
     #DELNITEM QueueData $Count
     $RES=%concat("Command ",$Count," canceled")
     $Count=1
    }
    $Count=($Count-1)
   }
  }
 }
 ("RESET") {
  #STOP QueueExecutorS
  #STOP QueueExecutor
  #RESET QueueSystem
  #THREAD {QE} {QueueExecutor}
 } {
  #SECTION QD {
   #IF (@QueueData) {
    QueueData=%concat(@QueueData,"|",$Command,"=",$RT)
   } {
    QueueData=%concat($Command,"=",$RT)
   }
  }
  #IF ((%threadname("QueueExecutor")="")&&(%threadname("QueueExecutorS")="")) {
   #THREAD {QE} {QueueExecutor}
  }
  $RES="command added"
 }
#RESUME QueueExecutor
#RESUME QueueExecutor
#RETURN $RES]]></value>
    <arglist>$Command, $RT, $Action</arglist>
  </func>
</cmud>


It largely works. I changed the #SECTIONS to be shorter where I could, but some had local variables in them that were specific to the #SECTION and I wasn't sure how to handle that. Those sections don't appear to call anything that would cause obvious branching, but I probably don't know all the things that could cause it.

The problem is it still hangs sometimes. What's weirder is it seems to hang most often when that "You finish humming" trigger executes twice off the single line. I really can't figure out what's making that happen. The times it doesn't make the queue hang it screws up the timing of everything so that it tries to send commands when I'm still in roundtime. Very weird.

I would try to catch it again in the script debugger, but, well. :-) All I have is this post above: http://forums.zuggsoft.com/forums/viewtopic.php?p=137764#137764
Reply with quote
Nattie
Apprentice


Joined: 24 Jul 2008
Posts: 109

PostPosted: Sat Sep 06, 2008 6:23 am   
 
Yeah, it seems like things only go batty when the "You finish humming" trigger executes twice for some reason.

Since I can't use the script debugger, here's the best I can do. This all happened in less than two seconds. I was running a script with roundtimes while the VocMind class of triggers was enabled from the Vocals class I posted earlier.

Code:
>
You finish humming a quiet lament.

exp skill first aid
> exp skill vocals

Showing First Aid experience:

          SKILL: Rank/Percent towards next rank/Amount learning
       First Aid:     67 39.81% concentrating
exp skill vocals

Time Development Points: 25  Favors: 7  Deaths: 0
Overall state of mind: clear
EXP HELP for more information
>
Showing Vocals experience:

          SKILL: Rank/Percent towards next rank/Amount learning
          Vocals:     88 56.82% perplexed   
turn my compendium

Time Development Points: 25  Favors: 7  Deaths: 0
Overall state of mind: clear
EXP HELP for more information
>
Showing Vocals experience:

          SKILL: Rank/Percent towards next rank/Amount learning
          Vocals:     88 56.82% perplexed   
hum lament

Time Development Points: 25  Favors: 7  Deaths: 0
Overall state of mind: clear
EXP HELP for more information
>
...wait 18 seconds.
>
You begin to hum a quiet lament with only the slightest hint of difficulty.
> hum lament

You are already performing something.  You should stop that first.


The script with roundtimes seems to run fine if those triggers aren't going in the background. Is there any reason this trigger would execute twice off receiving the pattern once?:

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="30550" regex="true" copy="yes">
    <pattern>You finish humming [^\n]*\.$</pattern>
    <value>#CALL @queue("exp skill vocals")</value>
  </trigger>
</cmud>


It will execute twice off that trigger most of the time, but sometimes not. It will do so even if it's the only thing I've run that session.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Sep 06, 2008 2:55 pm   
 
I finally figured out why CMud was double triggering many of your patterns. The problem is your usage of \n in the pattern. The presence of that causes CMud to think you are looking to make a multiline pattern. Then when another line is received CMud would test both lines together against the pattern. It would match each time. Correcting the wildcard in the pattern fixed these problems.

I restructured all of your triggers to have a better flow. As I had been saying from the start there was no need to have 2 trigger working off the 'slightest difficulty line'. Among the other changes I made the vocplay variable a #VARFUNC so that it automatically updates.
I also put the sectioning in QueueExecutor back the way I originally had it. I have to disagree with Zugg about the need to protect reads within #SECTIONs. I would protect all of them and the logic that is based on their values if CMud could. Technically it can, but that is a huge script (maybe I could make it shorter with Lua) and is far beyond this discussion.
Finally I removed the #SAY in the QueueExecutor, and put in a few more return values. There might still be a bug or 2 in the QueueSystem scripts, but I am not finding any right now.
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <class name="QueueSystem" copy="yes">
    <func name="Queue" copy="yes">
      <value><![CDATA[#LOCAL $RES
#SWITCH ($Action)
 ("D") {
  $Com=%item(@PendingCommands,1)
  #IF (%dbkeys($Com)=$Command) {
   #SECTION PD {
    #DELNITEM PendingCommands 1
    #IF (@PendingCommands="") {
     #IF (%threadname("QueueExecutorS")) {#SIGNAL RTPending 1}
    }
   }
   $RES="command removed"
  } {
   $Com=%item(@PendingCommands,2)
   #IF (%dbkeys($Com)=$Command) {
    #SECTION PD {
     $RES=%concat("Warning, ",%item(@PendingCommands,1)," also removed")
     PendingCommands=""
     #IF (%threadname("QueueExecutorS")) {#SIGNAL RTPending 1}
    }
   } {
    $RES=%concat("Command ",$Command," was not currently pending")
   }
  }
 }
 ("C") {
  $Count=1
  #SECTION QD {
   $Max=%numitems(@QueueData)
   #WHILE ($Count<=$Max) {
    #IF (%dbkeys(%item(@QueueData,$Count))=$Command) {
     #DELNITEM QueueData $Count
     $RES=%concat("Command ",$Count," canceled")
     $Count=$Max
    }
    $Count=($Count+1)
   }
  }
 }
 ("CA") {
  #SECTION QD {
   $QD=%subregex(@QueueData,%concat("(?:\A|\|)",$Command,"=[^|]*(?=\||\z)"),"(?(^)(?INSTANCE)�)")
   $RES=%concat(%word($QD,1,"�")," entries canceled")
   QueueData=%word($QD,2,"�")
  }
 }
 ("CL") {
  #SECTION QD {
   $Count=%numitems(@QueueData)
   #WHILE ($Count) {
    #IF (%dbkeys(%item(@QueueData,$Count))=$Command) {
     #DELNITEM QueueData $Count
     $RES=%concat("Command ",$Count," canceled")
     $Count=1
    }
    $Count=($Count-1)
   }
  }
 }
 ("RESET") {
  #STOP QueueExecutorS
  #STOP QueueExecutor
  #RESET QueueSystem
  #THREAD {QE} {QueueExecutor}
 } {
  #SECTION QD {
   #IF (@QueueData) {
    QueueData=%concat(@QueueData,"|",$Command,"=",$RT)
   } {
    QueueData=%concat($Command,"=",$RT)
   }
  }
  #IF ((%threadname("QueueExecutor")="")&&(%threadname("QueueExecutorS")="")&&(%threadname("QE")="")) {
   #THREAD {QE} {QueueExecutor}
  }
  $RES="command added"
 }
#RESUME QueueExecutor
#RESUME QueueExecutor
#RETURN $RES]]></value>
      <arglist>$Command, $RT, $Action</arglist>
    </func>
    <var name="QueueData" type="StringList" usedef="true" copy="yes"/>
    <var name="PendingCommands" type="StringList" usedef="true" copy="yes"/>
    <alias name="QueueExecutor" copy="yes">
      <value>#IF (%threadname("QueueExecutor")) {#EXIT}
#IF (%threadname("QueueExecutorS")) {#EXIT}
#WAIT
#CALL %threadname(,"QueueExecutor")
#LOCAL $Command
#WHILE (1) {
 #IF (@QueueData) {
  #IF (%numitems(@PendingCommands)<2) {
   #SECTION QD {$Command=%pop(QueueData)}
   #SECTION PD {
    #IF (@PendingCommands) {
     PendingCommands=%concat(@PendingCommands,"|",$Command)
    } {
     PendingCommands=$Command
    }
   }
   #SEND {%dbkeys($Command)}
   #IF (%dbvalues($Command)) {
    #SIGNAL RTPending 0
    #CALL %threadname(,"QueueExecutorS")
    #WAITSIGNAL RTPending
    #CALL %threadname(,"QueueExecutor")
   }
  } {
   #SUSPEND QueueExecutor
  }
 } {
  #SUSPEND QueueExecutor
 }
 #IF (@RoundTime) {
  #WAIT (@RoundTime*1000)
  #SECTION RT {RoundTime=0}
 }
}</value>
    </alias>
    <var name="RoundTime" type="Integer" usedef="true" copy="yes">
      <value>0</value>
      <default>0</default>
    </var>
    <trigger priority="70" copy="yes">
      <pattern>Roundtime(?:\:)?\s+(\d(?:\d)*)</pattern>
      <value>#SECTION RT {
 RoundTime=%1
}
#SIGNAL RTPending 1</value>
    </trigger>
  </class>
  <class name="vocals" copy="yes">
    <alias name="zvocals" copy="yes">
      <value>#IF (%1=="") {
 #IF (%class("VocTriggers")) {
  #SHOW Vocals already active
  #EXIT
 }
 #T+ VocTriggers
 #IF (@vocdiff<1) {#VAR vocdiff 1}
 #VAR vocstate 0
 #CALL @queue("hum " @vocplay)
}

#IF (%1=="end") {
 #IF (%threadname("Vocals")) {
  #STOP Vocals
  #T- VocMind
  #T- VocTriggers
 } {
  #IF (%class("VocTriggers")) {
   #CALL @queue("stop hum")
  }
  #VAR vocstate 1
 }
}
#IF (%1=="done") {
 #T- VocMind
 #T- VocTriggers
}</value>
    </alias>
    <var name="vocdiff" type="Integer" usedef="true" copy="yes">
      <value>12</value>
      <default>10</default>
    </var>
    <var name="vocplay" copy="yes">%db(@playdifficulty,@vocdiff)</var>
    <class name="VocTriggers" copy="yes">
      <trigger name="vocmessage3" priority="30" case="true" stop="true" regex="true" copy="yes">
        <pattern>You begin to hum (?:\w+ ?){1,4}.$</pattern>
        <value>#CALL @queue("hum " @vocplay,,"D")
#ADD vocdiff 1
#CALL @queue("stop hum")</value>
      </trigger>
      <trigger name="vocmessage1" priority="30" stop="true" regex="true" copy="yes">
        <pattern>You effortlessly begin to hum (?:\w+ ){0,3}\w+, your heart swelling in pride at your hard-earned skill\.$</pattern>
        <value>#CALL @queue("hum " @vocplay,,"D")
#ADD vocdiff 2
#CALL @queue("stop hum")</value>
      </trigger>
      <trigger name="vocmessage2" priority="30" stop="true" regex="true" copy="yes">
        <pattern>You begin to hum (?:\w+ ){0,3}\w+, your skill in your craft showcased in every note\.$</pattern>
        <value>#CALL @queue("hum " @vocplay,,"D")
#ADD vocdiff 2
#CALL @queue("stop hum")</value>
      </trigger>
      <trigger name="vocmessage6" priority="30" stop="true" regex="true" copy="yes">
        <pattern>You begin to hum (?:\w+ ){1,4}with only the slightest hint of difficulty\.$</pattern>
        <value>#CALL @queue("hum " @vocplay,,"D")</value>
      </trigger>
      <trigger name="vocmessage4" priority="30" stop="true" regex="true" copy="yes">
        <pattern>You fumble slightly as you begin to hum (?:\w+ ?){1,4}\.$</pattern>
        <value>#CALL @queue("hum " @vocplay,,"D")
#ADD vocdiff -1
#CALL @queue("stop hum")
#VAR vocstate 2 </value>
      </trigger>
      <trigger name="vocmessage5" priority="30" stop="true" regex="true" copy="yes">
        <pattern>You struggle to begin to hum (?:\w+ ?){1,4}\.$</pattern>
        <value>#CALL @queue("hum " @vocplay,,"D")
#ADD vocdiff -1
#CALL @queue("stop hum")</value>
      </trigger>
      <trigger priority="30" stop="true" copy="yes">
        <pattern>You stop playing your song.$</pattern>
        <value>#CALL @queue("stop hum",,"D")
#SWITCH (@vocstate)
 (1) {
  zvocals done
 }
 (2) {
  #T+ VocMind
  #CALL @queue("exp skill vocals")
  #T- VocTriggers
  #VAR vocstate 0
 } {
  #CALL @queue("hum " @vocplay)
 }</value>
      </trigger>
      <trigger priority="30" stop="true" regex="true" copy="yes">
        <pattern>You finish humming (?:\w+ ?){1,4}\.$</pattern>
        <value>#T+ VocMind
#T- VocTriggers
#CALL @queue("exp skill vocals")</value>
      </trigger>
    </class>
    <trigger name="VocMind" priority="10" case="true" stop="true" regex="true" copy="yes">
      <pattern>^\s+Vocals:\s+\d+\s+\d+\.\d+%\s+([\w ]+)</pattern>
      <value>#CALL @queue("exp skill vocals",,"D")
#IF (@vocstate==0) {
 #IF (%ismember(%1,"dazed|mind lock")) {
  #THREAD {Vocals} {
   #WAIT 120000
   #CALL @queue("exp skill vocals")
  }
 } {
  #T+ VocTriggers
  #T- VocMind
  #CALL @queue("hum " @vocplay)
 }
} {
 zvocals done
}</value>
    </trigger>
    <var name="playdifficulty" type="Record" sorted="true" copy="yes">1=scales|10=lament|11=wedding|12=hymn|13=rumba|14=polka|15=battle|16=reel|17=elegy|18=serenade|19=minuet|2=arpeggio|20=psalm|21=dirge|22=gavotte|23=tango|24=tarantella|25=bolero|26=nocturne|27=requiem|28=fantasia|29=rondo|3=ditty|30=aria|31=sonata|32=concerto|4=folk|5=ballad|6=waltz|7=lullaby|8=march|9=jig</var>
    <var name="vocstate" type="Integer" usedef="true" copy="yes">
      <value>1</value>
      <default>0</default>
    </var>
  </class>
</cmud>
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Nattie
Apprentice


Joined: 24 Jul 2008
Posts: 109

PostPosted: Wed Sep 24, 2008 6:24 pm   
 
I just got around to messing with this again. I copied all that into a separate session and it doesn't (appear to) do anything. When I type "zvocals" it says it's already active, which when I looked at the new code made sense. But typing "zvocals end" doesn't disable the class, either. It doesn't appear to do anything. I tried disabling the class VocTriggers class manually, then typing "zvocals" but all it does is enable the triggers and do these two lines:

#IF (@vocdiff<1) {#VAR vocdiff 1}
#VAR vocstate 0

It does not do the #CALL @queue("hum " @vocplay) that follows, or anything else. Typing zvocals again just gives me the active message again.

I checked the queue and it's not in the @PendingCommands or @QueueData either. #THREAD doesn't show a queue thread or a vocals thread, just the normal thread.

I tried to check the triggers by typing "hum @vocplay" manually, and it hummed, and it changed the variable, but it didn't send the "stop hum" command. The stop hum command wasn't in either of the queue variables. There was no thread for the queue.

Since it seemed like a problem with the queue, I exported just the vocals part to XML, then went back to my other test session where I had edited the queue like Zugg had instructed, and imported just the vocals. The queue starts up and works properly there.

After testing the triggers, I don't think I've explained very well how the vocals skill works. :-/ I might be misunderstanding the triggers, but it looks like it just settles on the first message that gives it the "slightest hint of difficulty," even if there are more difficult things I could play which give the same message. I'm at a weird point in my vocals skill where only a single song type gives me this message, so I can't test it right now.

It also sends the command to hum even if gets the message that I'm dazed or mind locked, and does not start the "Vocals" thread. The #IF n the VocMind trigger isn't being matched for some reason, so it executes the else. I tried simplifying it down for testing purposes, to just #IF (%1="mind lock") when I was mind-locked, and then entering exp skill vocals manually, and the #IF still wouldn't catch it. I entered the pattern in the trigger's tester and it gave me back "mind lock" correctly. I'm not sure why it's doing the else.
Reply with quote
Nattie
Apprentice


Joined: 24 Jul 2008
Posts: 109

PostPosted: Wed Sep 24, 2008 6:42 pm   
 
Aha, I think I figured out why it was executing the else. It's because the pattern was catching some space after "mind lock" and "dazed," so %1 would be things like "mind lock " rather than just "mind lock". I changed the pattern a little and that part seems to work now, at least. :-)
Reply with quote
Nattie
Apprentice


Joined: 24 Jul 2008
Posts: 109

PostPosted: Wed Sep 24, 2008 6:50 pm   
 
Regarding the queue, I have it disregard RT sometimes... All the commands sent to the game here were sent by the queue:

Code:
You turn to the section containing Gor'Tog physiology.
> study my compendium

You begin to study the Gor'Tog chart, having a difficult time comprehending the advanced text.
Roundtime: 20 seconds.
>
You finish humming a quiet lament.

exp skill first aid
exp skill vocals
>
Showing First Aid experience:

          SKILL: Rank/Percent towards next rank/Amount learning
       First Aid:     67 70.68% muddled     
turn my compendium

Time Development Points: 26  Favors: 7  Deaths: 0
Overall state of mind: clear
EXP HELP for more information
>
...wait 19 seconds.
>
Showing Vocals experience:

          SKILL: Rank/Percent towards next rank/Amount learning
          Vocals:     89 39.16% mind lock   

Time Development Points: 26  Favors: 7  Deaths: 0
Overall state of mind: clear
EXP HELP for more information


To summarize what happened there, I got into an RT of 20 seconds, then VocMind triggered and sent "exp skill vocals" to the queue, and for some reason that pushed "exp skill first aid" through to the game before the roundtime was up, and then "exp skill vocals." I can actually enter those commands while in RT so they outputted okay, but it then tried to "turn my compendium" after the first two commands, because that triggers off the "exp skill first aid" message. I was in roundtime, though, so the game told me to wait 19 seconds.

This happens every time I finish humming if I am in RT.

To clarify, I'm using the edits Zugg advised because I couldn't get the one you posted most recently to start up. The queue has been doing this since before the edits, though, so I'm not sure if the changes address that or not.

Thank you for all the help...
Reply with quote
Nattie
Apprentice


Joined: 24 Jul 2008
Posts: 109

PostPosted: Wed Sep 24, 2008 7:35 pm   
 
Ah, the queue does the same thing when the "Vocals" thread ends its #WAIT and sends "exp skill vocals:"

Code:
You turn to the section containing Dwarven physiology.
> study my compendium

You begin to study the Dwarven chart, having a difficult time comprehending the advanced text.
Roundtime: 20 seconds.
> exp skill first aid
exp skill vocals

Showing First Aid experience:

          SKILL: Rank/Percent towards next rank/Amount learning
       First Aid:     67 94.98% pondering   
turn my compendium

Time Development Points: 26  Favors: 7  Deaths: 0
Overall state of mind: clear
EXP HELP for more information
>
Showing Vocals experience:

          SKILL: Rank/Percent towards next rank/Amount learning
          Vocals:     89 75.85% bewildering 
hum lament

Time Development Points: 26  Favors: 7  Deaths: 0
Overall state of mind: clear
EXP HELP for more information
>
...wait 19 seconds.


Tentatively, it seems like it doesn't like it when I have something using the queue, then something from another thread or trigger also sends something to the queue. The queue commands from the other thread or trigger seem to force the queue to send its commands, even when it should be continuing to wait for RT.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net