![](templates/Classic/images/spacer.gif) |
Anaristos Sorcerer
Joined: 17 Jul 2007 Posts: 821 Location: California
|
Posted: Wed Jun 11, 2008 12:26 am
CMUD 226 - Running this script bombs CMUD with Access Violation |
I was experimenting with a script to recast missed spells after triggers were disabled for some reason or I lost my connection. Here is the entire XML for the script, triggers and variables that go with it:
Code: |
<class name="Recovery" id="12411">
<trigger name="sprtrig" priority="124120" regex="true" enabled="false" id="12412">
<pattern>^You are affected by the following:$</pattern>
<value>#TEMP {^$} {recproc}</value>
<trigger type="Loop Lines" param="100" regex="true" enabled="false">
<pattern>(Spell|Skill|Recovery)\s*: ([^\(]+)[^\)]+\)</pattern>
<value>$data.type = %ismember( %trim( %1), "Spell|Skill|Recovery")
$data.name = %trim( %2)
;;
#ADDITEM reclist $data</value>
</trigger>
</trigger>
<alias name="recproc" id="12413">
<value>#STATE sprtrig 0
#T- sprtrig
;;
$table = %concat( "[Spells ", @Username, "]")
$sql = %concat( "SELECT Sn FROM ", $table, " WHERE Name = ?")
;;
$allspells = %expandlist( @ArmorList, " ")
$allspells = %concat( $allspells, " ", %expandlist( @StatList, " "), " ")
$allspells = %concat( $allspells, %replace( @MiscList, " "))
$allspells = %replace( $allspells, " ", "|")
$allspells = %sort( %additem( %number( 58), $allspells))
;;
$reclist = ""
;;
#FORALL @reclist {
$rec = @comsql.Execute($sql, %i.name)
#DELITEM $allspells %db( $rec, Sn)
}
;;
#FORALL $allspells {addspell %i}
;;
#ECHO %cr
;;
#MXP Active spells list processed
;;
#ECHO %cr</value>
</alias>
<var name="reclist" type="StringList" id="12415">"type=1|name=Enhanced strength"|"type=1|name=Giant strength"|"type=1|name=Fly"|"type=1|name=Power of faith"|"type=1|name=Intellect fortress"|"type=1|name=Barkskin"|"type=1|name=Darkness"|"type=2|name=Sneak"|"type=1|name=Invis"|"type=1|name=Energy containment"|"type=1|name=Calculation"|"type=1|name=Avoidance"|"type=1|name=Thought shield"|"type=1|name=Displacement"|"type=1|name=Holy mirror"|"type=1|name=Toxic resistance"|"type=1|name=Armor"|"type=1|name=Blur"|"type=1|name=Protection evil"|"type=1|name=Magic circle"|"type=1|name=Haste"|"type=1|name=Frenzy"|"type=1|name=Channel energy"|"type=1|name=Holy aura"|"type=1|name=Awakening"|"type=1|name=Revelation"|"type=1|name=Sustenance"|"type=1|name=Divine swiftness"|"type=1|name=Perception"|"type=1|name=Prayer of fortune"|"type=1|name=Energy ball"|"type=1|name=Magical rush"|"type=1|name=Godly embrace"|"type=1|name=Harden body"|"type=1|name=Enlightenment"|"type=1|name=Aid"|"type=1|name=Bless"|"type=1|name=Heat shield"|"type=1|name=Mystic might"|"type=1|name=Adrenaline control"|"type=1|name=Grey aura"|"type=1|name=Sense anger"|"type=1|name=Globe of invulnerability"|"type=1|name=Lightspeed"|"type=1|name=Underwater breathing"|"type=1|name=Absorb"|"type=1|name=Gaias revenge"|"type=1|name=Compression"|"type=1|name=Pass door"|"type=1|name=Stone skin"|"type=1|name=Vaccinate"|"type=2|name=Pass without trace"|"type=1|name=Spirit shield"|"type=3|name=Gaia"</var>
<alias name="recinit" id="12416">
<value>reclist = ""
;;
#CALL %vartype( reclist, 4)
;;
#T+ sprtrig
;;
saffects</value>
</alias>
<var name="templist" id="12418">126|72|4|140|171|139|168|135|423|112|119|185|118|97|155|421|51|53|424|422|425|116|428|429|123|427|76|435|430|157|431|440|434|426|333|5|67|518|48|235|317|512|484|91|64|49|321|164|437|152|154|253|335|439|174|248|249|252|250|255|259|254|58</var>
</class>
|
As you can see, the above includes what the trigger captured (variable reclist).
When I run the procedure, which gets running by issuing the recinit alias CMUD will hang for a while and then return with an application error of access violation.
Here follows the dump which I was not able to send:
Code: |
date/time : 2008-06-10, 17:09:03, 685ms
computer name : ****
user name : ****
registered owner : ****
operating system : Windows Vista Service Pack 1 build 6001
system language : English
system up time : 41 minutes 35 seconds
program up time : 5 minutes 56 seconds
processors : 2x Intel(R) Core(TM) Duo CPU T2350 @ 1.86GHz
physical memory : 860/2037 MB (free/total)
free disk space : (C:) 62.64 GB
display mode : 1440x900, 32 bit
process id : $238
allocated memory : 125.33 MB
executable : cMUDPro.exe
exec. date/time : 2008-06-05 16:04
version : 2.26.0.0
compiled with : BCB 2006/07
madExcept version : 3.0h
contact name : ****
contact email : ****
callstack crc : $58853478, $55095437, $55095437
exception number : 1
exception class : EAccessViolation
exception message : Access violation at address 00404DA2 in module 'cMUDPro.exe'. Read of address 65636FBA.
Main ($e20):
00404da2 +0006 cMUDPro.exe System 8832 +1 TObject.Free
00ad7563 +0033 cMUDPro.exe SBX509Ext 1421 +8 TElPolicyMappingsExtension.SetCount
00e68a0b +001f cMUDPro.exe PrefDat 9621 +2 PrefRec.Execute
00dbaa21 +0151 cMUDPro.exe MAIN 6277 +14 TMUDForm.ExecThread
00dc36c6 +04d6 cMUDPro.exe MAIN 9082 +95 TMUDForm.ExecTrig
00dc1130 +126c cMUDPro.exe MAIN 8284 +331 TMUDForm.HandleTrigger
00dbf9af +000f cMUDPro.exe MAIN 7779 +1 TMUDForm.UserOutNewLine
00a5bad5 +0039 cMUDPro.exe term 8944 +3 TTerm.DoTriggerLine
00a5a4d8 +0218 cMUDPro.exe term 8514 +34 HandleNewLine
00a5accc +06e4 cMUDPro.exe term 8638 +104 TTerm.PutText
00a5b28b +0053 cMUDPro.exe term 8744 +2 TTerm.Add
00da9921 +00b1 cMUDPro.exe MAIN 1601 +8 TMUDForm.OutputStr
00dacdde +0066 cMUDPro.exe MAIN 2383 +4 SendBuf
00dade5d +0c25 cMUDPro.exe MAIN 2711 +231 TMUDForm.ProcessMUDBuffer
00da99f9 +002d cMUDPro.exe MAIN 1622 +1 TMUDForm.ParseOut
00da9af8 +0048 cMUDPro.exe MAIN 1645 +4 TMUDForm.EchoStr
00dae72c +0134 cMUDPro.exe MAIN 2900 +22 TMUDForm.EchoPas
00dae542 +004a cMUDPro.exe MAIN 2856 +4 TMUDForm.EchoInfo
00def1dc +00a0 cMUDPro.exe MAIN 19357 +12 TMUDForm.ExecCommand
00e76725 +00a9 cMUDPro.exe CodeExec 914 +9 ExecMUDCommand
00e7c593 +044b cMUDPro.exe CodeExec 2546 +45 DoDefault
00e7d63b +0f2f cMUDPro.exe CodeExec 2816 +254 HandleCom
00e7ebbc +0600 cMUDPro.exe CodeExec 3228 +108 TCodeExec.InternalExecute
00e7576b +005f cMUDPro.exe CodeExec 459 +8 TCodeExec.Execute
00e77cec +02b0 cMUDPro.exe CodeExec 1264 +48 ExecAlias
00e78498 +0144 cMUDPro.exe CodeExec 1387 +15 PushPref
00e78ac1 +02a1 cMUDPro.exe CodeExec 1491 +45 HandleVar
00e79392 +06ba cMUDPro.exe CodeExec 1605 +88 HandleVarRef
00e7eaec +0530 cMUDPro.exe CodeExec 3207 +87 TCodeExec.InternalExecute
00e7576b +005f cMUDPro.exe CodeExec 459 +8 TCodeExec.Execute
00e6c4c0 +0098 cMUDPro.exe PrefDat 11125 +8 TCacheNode.Execute
00e687c2 +024e cMUDPro.exe PrefDat 9565 +41 PrefRec.InternalExecute
00e68a0b +001f cMUDPro.exe PrefDat 9621 +2 PrefRec.Execute
00dbaa21 +0151 cMUDPro.exe MAIN 6277 +14 TMUDForm.ExecThread
00dc36c6 +04d6 cMUDPro.exe MAIN 9082 +95 TMUDForm.ExecTrig
00dc1130 +126c cMUDPro.exe MAIN 8284 +331 TMUDForm.HandleTrigger
00dbf9af +000f cMUDPro.exe MAIN 7779 +1 TMUDForm.UserOutNewLine
00a5bad5 +0039 cMUDPro.exe term 8944 +3 TTerm.DoTriggerLine
00a5a4d8 +0218 cMUDPro.exe term 8514 +34 HandleNewLine
00a5accc +06e4 cMUDPro.exe term 8638 +104 TTerm.PutText
00a5b28b +0053 cMUDPro.exe term 8744 +2 TTerm.Add
00da9921 +00b1 cMUDPro.exe MAIN 1601 +8 TMUDForm.OutputStr
00da9bf6 +00d6 cMUDPro.exe MAIN 1682 +25 TMUDForm.NextMUDLine
00daa0a9 +0019 cMUDPro.exe MAIN 1759 +4 TMUDForm.DoNextLine
004bb0d7 +02bb cMUDPro.exe Controls 5146 +83 TControl.WndProc
004bf0db +04fb cMUDPro.exe Controls 7304 +111 TWinControl.WndProc
004a163b +0553 cMUDPro.exe Forms 3512 +136 TCustomForm.WndProc
004be804 +002c cMUDPro.exe Controls 7073 +3 TWinControl.MainWndProc
0047c448 +0014 cMUDPro.exe Classes 11583 +8 StdWndProc
76c8490f +0010 kernel32.dll BaseThreadInitThunk
|
What makes this interesting is that this procedure worked just fine until I changed the trigger script to insert a data variable into the string list containing a code for the entry type plus the spell name rather than just entering the spell name into the list.
This will happen each time I run the procedure. |
|
_________________ Sic itur ad astra. |
|
|
![](templates/Classic/images/spacer.gif) |
Zugg MASTER
![](images/avatars/164475849040f41c23b22fe.gif)
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Jun 11, 2008 12:32 am |
I pasted your script into a blank session and then typed "recinit" and all it did was display:
saffects
on the screen. You need to give us something else so that we can test this in a blank session. My guess is that the "saffects" command does something on your MUD that displays something the trigger fires on, but without that data, I cannot reproduce it offline. |
|
|
![](templates/Classic/images/spacer.gif) |
Anaristos Sorcerer
Joined: 17 Jul 2007 Posts: 821 Location: California
|
Posted: Wed Jun 11, 2008 12:57 am |
Yes, it does. If you look at the data in reclist, the key/value pairs contain what the MUD sends which looks like this:
Code: |
You are affected by the following:
Spell : Awakening (11:57)
Spell : Revelation (11:59)
Spell : Sustenance (11:59)
Spell : Divine swiftness (12:00)
Spell : Perception (12:00)
Spell : Prayer of fortune (12:00)
Spell : Energy ball (12:00)
Spell : Magical rush (12:01)
Spell : Godly embrace (12:01)
Spell : Harden body (12:01)
Spell : Enlightenment (12:02)
Spell : Aid (12:02)
Spell : Bless (12:02)
Spell : Mystic might (12:44)
Spell : Power of faith (34:17)
Spell : Barkskin (13:25)
Spell : Thought shield (04:01)
Spell : Darkness (12:39)
Spell : Energy containment (14:09)
Spell : Holy mirror (07:16)
Spell : Toxic resistance (07:18)
Spell : Avoidance (13:27)
Spell : Underwater breathing (11:32)
Spell : Shockproof (06:24)
Spell : Energy shield (06:24)
Spell : Acidproof (06:24)
Spell : Warmth (06:25)
Spell : Wolf spirits (01:55)
Spell : Champions strength (02:40)
Spell : Flesh armor (04:12)
Spell : Displacement (10:12)
Spell : Shield (07:57)
Spell : Mental barrier (16:13)
Spell : Intellect fortress (50:54)
Spell : Absorb (01:25)
Spell : Fly (02:00:44)
Spell : Sense anger (20:29)
Spell : Enhanced strength (02:02:53)
Spell : Giant strength (02:02:54)
Spell : Grey aura (07:57)
Spell : Haste (39:28)
Spell : Lightspeed (32:22)
Spell : Frenzy (39:54)
Spell : Channel energy (39:55)
Spell : Compression (29:41)
Spell : Pass door (29:41)
Spell : Stone skin (29:42)
Skill : Sneak (02:04:13)
Skill : Pass without trace (07:13)
Spell : Invis (02:08:45)
Spell : Armor (46:27)
Spell : Blur (46:28)
Spell : Vaccinate (24:24)
Spell : Magic circle (41:55)
Spell : Holy aura (18:22)
Spell : Spirit shield (02:41)
Spell : Globe of invulnerability (09:21)
Spell : Adrenaline control (22:15)
Spell : Calculation (01:07:25)
Spell : Line of protection (13:55)
Spell : Indestructible aura (13:57)
Spell : Heat shield (27:09)
Spell : Protection evil (29:38)
Recovery: Gaia (02:17)
Recovery: Totem Aid (06:26)
|
one line at a time.
I translate Spell|Skill|Recovery into the type, which will be 1,2,3 respectively. I then obtain the spell/skill number from a database and compare that number from a fixed list containing all the possible spell/skills that I would cast, removing any matches. The remaining entries would be the spells/skills that I am missing. |
|
_________________ Sic itur ad astra. |
|
|
![](templates/Classic/images/spacer.gif) |
Zugg MASTER
![](images/avatars/164475849040f41c23b22fe.gif)
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Jun 11, 2008 1:03 am |
OK, that text still doesn't fire the trigger. You need to tell me EXACTLY what the MUD is displaying in response to the saffects command. Come on...it's not like I can read your mind or something. The harder you make this, the less likely it is to get fixed in v2.27.
|
|
|
![](templates/Classic/images/spacer.gif) |
Anaristos Sorcerer
Joined: 17 Jul 2007 Posts: 821 Location: California
|
Posted: Wed Jun 11, 2008 1:06 am |
I edited my first reply to show the entire output from the MUD when I type saffects, including the ending blank line.
The main trigger fires when the line You are affected by the following: is displayed. Then the #COND kicks in and stops when the #TEMP detects the blank line. |
|
_________________ Sic itur ad astra. |
|
|
![](templates/Classic/images/spacer.gif) |
Zugg MASTER
![](images/avatars/164475849040f41c23b22fe.gif)
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Jun 11, 2008 6:25 pm |
OK, I was able to reproduce it now, thanks. It does look like a problem with the #TEMP trigger somehow, but at least now I have a way to reproduce it.
|
|
|
![](templates/Classic/images/spacer.gif) |
Anaristos Sorcerer
Joined: 17 Jul 2007 Posts: 821 Location: California
|
Posted: Wed Jun 11, 2008 11:15 pm |
Yes, I was going to post that. I found out that the #TEMP trigger was not being deleted. I should point out that the script worked until I added the #ECHO command that outputs the carriage return. I think that the problem lies in that direction. The #TEMP trigger might be getting confused by the CR.
|
|
_________________ Sic itur ad astra. |
|
|
![](templates/Classic/images/spacer.gif) |
Zugg MASTER
![](images/avatars/164475849040f41c23b22fe.gif)
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Jun 11, 2008 11:32 pm |
Yep. The #TEMP trigger doesn't get deleted until after it has finished executing. And doing the #ECHO %cr in your recproc alias is causing the #TEMP trigger to fire again.
I think all I need to do is make #TEMP triggers disable the "Trigger on Trigger" option so that they don't cause themselves to fire again. Although I thought I already had code in CMUD to prevent recursive trigger firing like this.
In any case, I hope to get time to fix this before the 2.27 release tomorrow. Still a few other things on my list that I need to fix first. |
|
|
![](templates/Classic/images/spacer.gif) |
Anaristos Sorcerer
Joined: 17 Jul 2007 Posts: 821 Location: California
|
Posted: Fri Jun 13, 2008 9:19 pm |
Actually, Zugg, the #TEMP isn't being deleted at all. I have found a whole stash of them in my session window class. Every time I run a script that uses this type of trigger I create a permanent #TEMP trigger, it seems.
Also, they are very hard to delete. CMUD goes does not remove them from sight until after a class or filter switch takes place. The consolation is that they seem to be reusable. |
|
_________________ Sic itur ad astra. |
|
|
![](templates/Classic/images/spacer.gif) |
Zugg MASTER
![](images/avatars/164475849040f41c23b22fe.gif)
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Jun 16, 2008 4:43 pm |
Manually delete all of your #TEMP triggers. If you have one of them still in your settings, then I think CMUD will use that instead of creating a new one.
After manually deleting your temp triggers, try it again in 2.27. I thought this bug was fixed in that version. |
|
|
![](templates/Classic/images/spacer.gif) |
|
|