Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Thu Dec 06, 2007 2:20 am   

[2.14a] Access Violation Crash when a #say statement is removed.
 
This is the heart of the code for my vial sorting routine. This as it is listed below will run correctly with all the correct values.

However if I eliminate the #say:
#say get $temp_name from @container

To:
get $temp_name from @container

It will crash the program with an access violation. Why would it work properly when it's in a say but crash when I try to execute it?

Code:
#local $temp_name
#loopdb @vial_list {
  #forall %db( @vial_list, %key) {put %key in @container}
  #addkey vial_list %key %sort( %db( @vial_list, %key))
  #forall %db( @vial_list, %key) {
    #call %regex( %i, "\d+_\d+_(\w+\d+)", $temp_name)
    #say get $temp_name from @container
    }
  }


Code:
<var name="vial_list" type="Record" id="4069">mana=352_500_Vial350749|venom=315_500_Vial203988|speed=346_500_Vial315065|health="351_500_Vial222531|440_500_Vial235898|440_500_Vial259005|440_500_Vial272622|440_500_Vial283443|440_500_Vial320042"|levitation=322_500_Vial284563|mending="313_500_Vial341970|440_500_Vial100489"|frost=314_500_Vial13901|empty="200_500_Vial121785|200_500_Vial127310|200_500_Vial166304|200_500_Vial349246|200_500_Vial50351|200_500_Vial78723|200_500_Vial91982"|epidermal=428_500_Vial238892|mass=378_500_Vial124102|immunity=359_500_Vial52103|restoration=406_500_Vial355284|caloric=402_500_Vial63500</var>


Last edited by ReedN on Thu Dec 06, 2007 5:36 am; edited 2 times in total
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu Dec 06, 2007 2:46 am   
 
Confirmed. Very interesting indeed.

I also see this crash using the slightly simplified form:

Code:
#local $temp_name
#loopdb @vial_list {
  #forall %val {put %key in @container}
  #addkey vial_list %key %sort( %val)
  #forall %val {
    #call %regex( %i, "\d+_\d+_(\w+\d+)", $temp_name)
    #say get $temp_name from @container
    }
  }


Incidentally, depending on what problem you're trying to solve with this code, there might be a simpler way to do it.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Thu Dec 06, 2007 3:39 am   
 
Confirmed.

I tried doing #SENDRAW but since it's not echoed to the screen I'm not sure if it's a valid work around.


[Edit] What's even stranger, is that if you have the debugger window open when this runs then it works perfectly.

Here's the debugger code.

Code:
0.0005 | c  untitled |  [1] untitled Comline : start : test
0.0015 | a  untitled |put mana in
0.0003 | h  untitled |<ESC>[2Sput mana in <ESC>[0m
0.0045 | a  untitled |get Vial350749 from
0.0003 | h  untitled |<ESC>[2Sget Vial350749 from <ESC>[0m
0.0023 | a  untitled |put venom in
0.0007 | h  untitled |<ESC>[2Sput venom in <ESC>[0m
0.0034 | a  untitled |get Vial203988 from
0.0003 | h  untitled |<ESC>[2Sget Vial203988 from <ESC>[0m
0.0022 | a  untitled |put speed in
0.0002 | h  untitled |<ESC>[2Sput speed in <ESC>[0m
0.0034 | a  untitled |get Vial315065 from
0.0003 | h  untitled |<ESC>[2Sget Vial315065 from <ESC>[0m
0.0021 | a  untitled |put health in
0.0002 | h  untitled |<ESC>[2Sput health in <ESC>[0m
0.0018 | a  untitled |put health in
0.0002 | h  untitled |<ESC>[2Sput health in <ESC>[0m
0.0006 | a  untitled |put health in
0.0002 | h  untitled |<ESC>[2Sput health in <ESC>[0m
0.0007 | a  untitled |put health in
0.0002 | h  untitled |<ESC>[2Sput health in <ESC>[0m
0.0007 | a  untitled |put health in
0.0003 | h  untitled |<ESC>[2Sput health in <ESC>[0m
0.0006 | a  untitled |put health in
0.0003 | h  untitled |<ESC>[2Sput health in <ESC>[0m
0.0023 | a  untitled |get Vial222531 from
0.0003 | h  untitled |<ESC>[2Sget Vial222531 from <ESC>[0m
0.0021 | a  untitled |get Vial235898 from
0.0003 | h  untitled |<ESC>[2Sget Vial235898 from <ESC>[0m
0.0011 | a  untitled |get Vial259005 from
0.0003 | h  untitled |<ESC>[2Sget Vial259005 from <ESC>[0m
0.0013 | a  untitled |get Vial272622 from
0.0004 | h  untitled |<ESC>[2Sget Vial272622 from <ESC>[0m
0.0012 | a  untitled |get Vial283443 from
0.0003 | h  untitled |<ESC>[2Sget Vial283443 from <ESC>[0m
0.0011 | a  untitled |get Vial320042 from
0.0003 | h  untitled |<ESC>[2Sget Vial320042 from <ESC>[0m
0.0012 | a  untitled |put levitation in
0.0003 | h  untitled |<ESC>[2Sput levitation in <ESC>[0m
0.0033 | a  untitled |get Vial284563 from
0.0003 | h  untitled |<ESC>[2Sget Vial284563 from <ESC>[0m
0.0021 | a  untitled |put mending in
0.0003 | h  untitled |<ESC>[2Sput mending in <ESC>[0m
0.0017 | a  untitled |put mending in
0.0002 | h  untitled |<ESC>[2Sput mending in <ESC>[0m
0.0029 | a  untitled |get Vial341970 from
0.0003 | h  untitled |<ESC>[2Sget Vial341970 from <ESC>[0m
0.0023 | a  untitled |get Vial100489 from
0.0003 | h  untitled |<ESC>[2Sget Vial100489 from <ESC>[0m
0.0012 | a  untitled |put frost in
0.0002 | h  untitled |<ESC>[2Sput frost in <ESC>[0m
0.0034 | a  untitled |get Vial13901 from
0.0003 | h  untitled |<ESC>[2Sget Vial13901 from <ESC>[0m
0.0021 | a  untitled |put empty in
0.0002 | h  untitled |<ESC>[2Sput empty in <ESC>[0m
0.0017 | a  untitled |put empty in
0.0002 | h  untitled |<ESC>[2Sput empty in <ESC>[0m
0.0008 | a  untitled |put empty in
0.0002 | h  untitled |<ESC>[2Sput empty in <ESC>[0m
0.0007 | a  untitled |put empty in
0.0002 | h  untitled |<ESC>[2Sput empty in <ESC>[0m
0.0007 | a  untitled |put empty in
0.0002 | h  untitled |<ESC>[2Sput empty in <ESC>[0m
0.0007 | a  untitled |put empty in
0.0004 | h  untitled |<ESC>[2Sput empty in <ESC>[0m
0.0007 | a  untitled |put empty in
0.0003 | h  untitled |<ESC>[2Sput empty in <ESC>[0m
0.0024 | a  untitled |get Vial121785 from
0.0003 | h  untitled |<ESC>[2Sget Vial121785 from <ESC>[0m
0.0021 | a  untitled |get Vial127310 from
0.0003 | h  untitled |<ESC>[2Sget Vial127310 from <ESC>[0m
0.0010 | a  untitled |get Vial166304 from
0.0003 | h  untitled |<ESC>[2Sget Vial166304 from <ESC>[0m
0.0011 | a  untitled |get Vial349246 from
0.0003 | h  untitled |<ESC>[2Sget Vial349246 from <ESC>[0m
0.0010 | a  untitled |get Vial50351 from
0.0003 | h  untitled |<ESC>[2Sget Vial50351 from <ESC>[0m
0.0021 | a  untitled |get Vial78723 from
0.0003 | h  untitled |<ESC>[2Sget Vial78723 from <ESC>[0m
0.0011 | a  untitled |get Vial91982 from
0.0003 | h  untitled |<ESC>[2Sget Vial91982 from <ESC>[0m
0.0017 | a  untitled |put epidermal in
0.0003 | h  untitled |<ESC>[2Sput epidermal in <ESC>[0m
0.0033 | a  untitled |get Vial238892 from
0.0003 | h  untitled |<ESC>[2Sget Vial238892 from <ESC>[0m
0.0021 | a  untitled |put mass in
0.0003 | h  untitled |<ESC>[2Sput mass in <ESC>[0m
0.0032 | a  untitled |get Vial124102 from
0.0003 | h  untitled |<ESC>[2Sget Vial124102 from <ESC>[0m
0.0022 | a  untitled |put immunity in
0.0003 | h  untitled |<ESC>[2Sput immunity in <ESC>[0m
0.0034 | a  untitled |get Vial52103 from
0.0003 | h  untitled |<ESC>[2Sget Vial52103 from <ESC>[0m
0.0023 | a  untitled |put restoration in
0.0003 | h  untitled |<ESC>[2Sput restoration in <ESC>[0m
0.0023 | a  untitled |get Vial355284 from
0.0003 | h  untitled |<ESC>[2Sget Vial355284 from <ESC>[0m
0.0022 | a  untitled |put caloric in
0.0003 | h  untitled |<ESC>[2Sput caloric in <ESC>[0m
0.0030 | a  untitled |get Vial63500 from
0.0002 | h  untitled |<ESC>[2Sget Vial63500 from <ESC>[0m
0.0007 | d  untitled |  [1] untitled Comline : stopped
_________________
Asati di tempari!
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Thu Dec 06, 2007 4:52 am   
 
Fang Xianfu wrote:
Confirmed. Very interesting indeed.

I also see this crash using the slightly simplified form:

Code:
#local $temp_name
#loopdb @vial_list {
  #forall %val {put %key in @container}
  #addkey vial_list %key %sort( %val)
  #forall %val {
    #call %regex( %i, "\d+_\d+_(\w+\d+)", $temp_name)
    #say get $temp_name from @container
    }
  }


Incidentally, depending on what problem you're trying to solve with this code, there might be a simpler way to do it.


I like your simplification, I don't know why I forgot to use %val.

What this does, if you're curious or have a better way to do it, is to order the vials in my inventory by placing them in a container
then removing them in the order to be used. Having them sorted in this way helps to avoid having two half full containers of the
same thing. Prior to this I grab all the vials and glue their data together for the sort that occurs here. By concatenating then sorting
I sort on two fields simultaneously (age, amount left).
Reply with quote
Zugg
MASTER


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

PostPosted: Thu Dec 06, 2007 2:34 pm   
 
This was caused by the bug with the string list cache. It works fine in v2.15.
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Fri Dec 07, 2007 3:02 am   
 
Confirmed working now with 2.15. Thanks!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
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