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
Nattie Posted: Wed Aug 06, 2008 1:26 pm
Getting lots of strange "bugs" and errors, what are my options?
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Sep 24, 2008 8:13 pm   
 
I will take another look at it. I still have what I posted last time sitting in a package, so
I should be able to check to make sure importing through the forum isn't causing a problem.
Looking at some other test cases shouldn't be too much trouble either.
_________________
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: Sat Sep 27, 2008 11:13 pm   
 
Thank you. :-)

I was messing with it some more today, without the vocals stuff running, to see if it gets caught up anywhere else too. I caught this:

Code:
> study my compendium

With a sudden moment of clarity, the information on the chart suddenly makes sense to you.
Roundtime: 10 seconds.
> exp skill first aid

Showing First Aid experience:

          SKILL: Rank/Percent towards next rank/Amount learning
       First Aid:     68 26.79% perplexing   

Time Development Points: 27  Favors: 7  Deaths: 0
Overall state of mind: clear
EXP HELP for more information
> turn my compendium

...wait 9 seconds.


There it tried to send a command after only a second of RT. These are the triggers involved:

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="33410" regex="true" copy="yes">
    <pattern>a sudden moment of clarity, the information on the chart suddenly makes sense to you\.$</pattern>
    <value>#CALL @queue("exp skill first aid")</value>
    <trigger param="100" regex="true">
      <pattern>Roundtime(?:\:)?\s+(\d(?:\d)*)</pattern>
      <value>#CALL @queue("study my compendium",,"D")</value>
    </trigger>
  </trigger>
</cmud>


Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger name="famind2" priority="30480" regex="true" copy="yes">
    <pattern>First Aid:\s+\d+\s+\d+\.\d+%\s+(?:clear|learning|thoughtful|pondering|concentrating|muddled|perplex|bewilder|very)</pattern>
    <value>#CALL @queue("exp skill first aid",,"D")
#IF (@compturns<11) {#CALL @queue("turn my compendium")}</value>
  </trigger>
</cmud>
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Sep 28, 2008 8:27 am   
 
I see what happened. I forgot to check the regex box on the round time trigger.

Where you send the "study my compendium" command you should be indicating to the queue that the command causes a round time. That is what the second parameter of the queue function is for. The usage would be:
#CALL @queue("study my compendium",1)

I would also suggest changing your first trigger slightly. Since you know the command will cause a round time, and it will be at least 1 second you can use a simple delay to for marking the command done.
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="33410" regex="true" copy="yes">
    <pattern>a sudden moment of clarity, the information on the chart suddenly makes sense to you\.$</pattern>
    <value>#CALL @queue("exp skill first aid")</value>
    <trigger type="Wait" param="500" regex="true">
      <value>#CALL @queue("study my compendium",,"D")</value>
    </trigger>
  </trigger>
</cmud>


Having messed around with it a bit, I thought it might be nice to pick up "...wait # seconds" as a secondary round time. I also added a back up order to the queue. This new order will pull the last command sent out of the pending and put it back to the top of the queue. The corrected round time trigger does this automatically when it sees the "..wait" message.
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}
 }
 ("BACK") {
  #SECTION PD {
   #CALL %regex(@PendingCommands,"(?:([^|]+)\|)?([^|]+)",PendingCommands,$Command)
   #IF ($Command) {
    #SECTION QD {
     QueueData=%push($Command,@QueueData)
    }
   }
  }
 } {
  #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><![CDATA[#IF (%threadname("QueueExecutor")) {#EXIT}
#IF (%threadname("QueueExecutorS")) {#EXIT}
#WAIT
#CALL %threadname(,"QueueExecutor")
#LOCAL $Command
#WHILE (1) {
 #CALL @QueueTest("top")
 #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)) {
    #CALL @QueueTest("await rt data")
    #SIGNAL RTPending 0
    #CALL %threadname(,"QueueExecutorS")
    #WAITSIGNAL RTPending
    #CALL %threadname(,"QueueExecutor")
   }
  } {
   #CALL @QueueTest("2 pending")
   #SUSPEND QueueExecutor
  }
 } {
  #CALL @QueueTest("queue empty")
  #SUSPEND QueueExecutor
 }
 #IF (@RoundTime) {
  #CALL @QueueTest("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="10" regex="true" copy="yes">
      <pattern>^(?:Roundtime:?|\.\.\.wait)\s+(\d+)</pattern>
      <value>#SECTION RT {
 RoundTime=%1
}
#IF (%begins(%trigger,"...")) {
 #CALL @Queue(,,"BACK")
}
#SIGNAL RTPending 1</value>
    </trigger>
    <func name="QueueTest" copy="yes" enabled="false">
      <value>#DEBUG {QueueExecutor states $Info}</value>
      <arglist>$Info</arglist>
    </func>
  </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: Thu Oct 09, 2008 4:03 am   
 
Oh, I noticed that the RT trigger wasn't regex early on and fixed that. Mine has been regex ever since I started using the queue, basically.

I do use #CALL @queue("study my compendium",1). I noted some posts ago that for whatever reason, using a delay for the second state was not reliable, and that waiting for the roundtime pattern worked consistently. Well, much more consistently than using the delay, anyway, since weird stuff like the above still happens sometimes.

Thank you for writing that. I'll test it out eventually. I've kind of lost the will to work on this atm, lol.
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
Page 4 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