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
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Tue Jul 15, 2008 3:38 am   

I give up... can someone help me? *sigh*
 
I've been racking my brains trying to figure this out... yet I cannot for the life of me figure out why it's not working... I've converted everything I can think of, yet it refuses to display properly.

Let me back up a little - I've been trying to convert a bigmap script that was written by Fiendish. I thought it would be a rather easy task, but I was wrong. For a display of what it is supposed to look like, click here. There, you can also download the original file for zMUD, and maybe take a closer look there. Here is what I've converted it to so far (at least, I hope it displays correctly...):

Code:
<class name="SelfUpdatingBigmap" setdefault="true" id="1229">
  <alias name="updatecontinent" id="1230">
    <value>#VARIABLE previouscontinentnumber ""
#CLASS continentupdateinternals 1
#STATE bigmapdelimiter 0
#T- bigmapcoords
#SEND {bigmap noself}
#GAG</value>
  </alias>
  <alias name="vidblainmap" id="1231">
    <value>#VARIABLE previouscontinentnumber ""
#CLR CONTINENTS
#window CONTINENTS %ansi( red, bold)"    COORDINATES NOT AVAILABLE IN VIDBLAIN"
#window CONTINENTS %ansi( white)
#window CONTINENTS %ansi( white)"  +-----------Vidblain-----------+----------------+"
#window CONTINENTS %ansi( white)"  | .     .  .       .           |----------------|"
#window CONTINENTS %ansi( white)"A |        .            .       .|----------------|"
#window CONTINENTS %ansi( white)"n |                              |----------------|"
#window CONTINENTS %ansi( white)"t |    .                         |----------------|"
#window CONTINENTS %ansi( white)"i |             *   *     ?      | Star Wars      |"
#window CONTINENTS %ansi( white)"p |                           .  |----------------|"
#window CONTINENTS %ansi( white)"o | .   "%ansi( blue, bold)"*"%ansi( white)"                        | Moongate       |"
#window CONTINENTS %ansi( white)"d |                    .         |----------------|"
#window CONTINENTS %ansi( white)"a |           ?           *      | Dune           |"
#window CONTINENTS %ansi( white)"l |      *       .               |----------------|"
#window CONTINENTS %ansi( white)"  |*                             |----------------|"
#window CONTINENTS %ansi( white)"C |                        . *   |----------------|"
#window CONTINENTS %ansi( white)"e |                .  .          |----------------|"
#window CONTINENTS %ansi( white)"l |    .    ?                  . | ST:TNG         |"
#window CONTINENTS %ansi( white)"e | .                  .         |----------------|"
#window CONTINENTS %ansi( white)"s |                              |----------------|"
#window CONTINENTS %ansi( white)"t |                        .     |----------------|"
#window CONTINENTS %ansi( white)"i |       .          *           |----------------|"
#window CONTINENTS %ansi( white)"a |             .                |----------------|"
#window CONTINENTS %ansi( white)"l |        .                     |----------------|"
#window CONTINENTS %ansi( white)"  |          .                  .|----------------|"
#window CONTINENTS %ansi( white)"M |                       ..     |----------------|"
#window CONTINENTS %ansi( white)"e |.*                            |----------------|"
#window CONTINENTS %ansi( white)"r |    *   *     ?               | The Darklight  |"
#window CONTINENTS %ansi( white)"i |        .                 .   |----------------|"
#window CONTINENTS %ansi( white)"d |           "%ansi( brown)"#"%ansi( white)"                  |----------------|"
#window CONTINENTS %ansi( white)"i |          "%ansi( brown)"#"%ansi( white)"^"%ansi( brown)"#"%ansi( white)"                *| Doom and Gloom |"
#window CONTINENTS %ansi( white)"a |      *                       |----------------|"
#window CONTINENTS %ansi( white)"n |                 .            |----------------|"
#window CONTINENTS %ansi( white)"  |             *   .         .. |----------------|"
#window CONTINENTS %ansi( white)"  +------------------------------+----------------+"
#window CONTINENTS %ansi( white)
#window CONTINENTS %ansi( white)"    Fundamental Celestial Plane"
#window CONTINENTS %ansi( white)</value>
  </alias>
  <alias name="bigmaphelp" id="1232">
    <value>#SAY ""
#SAY "+-------------------------------------------------------------------+"
#SAY "|               Aardwolf Self-Updating Bigmap Walker                |"
#SAY "|                        Author: Fiendish                           |"
#SAY "+-------------------------------------------------------------------+"
#SAY "|                                                                   |"
#SAY "|    Local maps are stored as text files in your mud directory.     |"
#SAY "|                                                                   |"
#SAY "+-------------------------------------------------------------------+"
#SAY "| List of Commands                                                  |"
#SAY "+---------------------+---------------------------------------------+"
#SAY "| updatecontinent     | Updates the map of the current continent.   |"
#SAY "+---------------------+---------------------------------------------+"
#SAY "| vidblainmap         | Displays a static map of Vidblain.          |"
#SAY "+---------------------+---------------------------------------------+"
#SAY "| bigmaphelp          | Displays this help screen.                  |"
#SAY "+---------------------+---------------------------------------------+"
#SAY ""</value>
  </alias>
  <alias name="atconnect" id="1233">
    <value>#SENDPROMPT %char( 255)%char( 250)%char( 102)%char( 2)%char( 1)%char( 255)%char( 240);#VARIABLE previouscontinentnumber ""</value>
  </alias>
  <var name="continentmapheights" type="StringList" id="1234">5=55|0=40|2=40|4=50|3=40|1=15</var>
  <var name="continentmapnumbers" type="Record" id="1235">0=The Continent of Mesolar|1=The Southern Ocean|2=Gelidus|3=The Dark Continent, Abend|4=Alagh, the Blood Lands|5=The Uncharted Oceans</var>
  <var name="currentwidth" id="1237">-1</var>
  <var name="coordinateline" id="1238">Location: 31, 26</var>
  <var name="coordinatepadding" id="1239"/>
  <var name="continentnumber" id="1240">0</var>
  <var name="mudxcoord" id="1241">31</var>
  <var name="mudycoord" id="1242">26</var>
  <var name="lastmudycoord" id="1243">26</var>
  <var name="previouscontinentnumber" id="1244">0</var>
  <var name="previouscontinentline" id="1245"/>
  <var name="reversexcoord" id="1246">32</var>
  <var name="reverseycoord" id="1247">15</var>
  <trigger name="bigmapcoords" priority="12480" regex="true" id="1248">
    <pattern>^{coords}(-?\d+),(-?\d+),(-?\d+)</pattern>
    <value>#GAG
#IF (%1 != -1) {drawmap %1 %2 %3}</value>
  </trigger>
  <trigger priority="12490" regex="true" id="1249">
    <pattern>^\{coords\}-1</pattern>
    <value>#GAG
#IF (@previouscontinentnumber != -1) {
  #VARIABLE previouscontinentnumber -1
  #CLR CONTINENTS
  #LOOP 5 {#WINDOW CONTINENTS %cr}
  #WINDOW CONTINENTS "     "%ansi( red, bold)"Continent view not currently enabled within areas."
  }</value>
  </trigger>
  <trigger priority="12500" regex="true" id="1250">
    <pattern>^\{bigmap\}(\d+),(.*)$</pattern>
    <value>#GAG</value>
  </trigger>
  <trigger priority="12510" case="true" regex="true" id="1251">
    <pattern>^\{/bigmap\}$</pattern>
    <value>#GAG</value>
  </trigger>
  <trigger priority="12520" case="true" verbatim="true" id="1252">
    <pattern>^Continent view is not available for this area.$</pattern>
    <value>#GAG
#CLASS continentupdateinternals 0
#T+ bigmapcoords</value>
  </trigger>
  <trigger priority="12530" case="true" verbatim="true" trigontrig="false" id="1253">
    <pattern>^Received Telopts to turn ON bigmap+coords.$</pattern>
    <value>#GAG</value>
  </trigger>
  <class name="continentupdateinternals" initdisable="true" setdefault="true" enabled="false" id="1254">
    <var name="continentmaptitlepart" id="1255">+------------------ The Continent of Mesolar </var>
    <var name="continent" id="1256">The Continent of Mesolar</var>
    <trigger name="bigmapdelimiter" priority="12580" trigontrig="false" id="1258">
      <pattern>^(+{------------------------------------------------------------|------------------------------}+)$</pattern>
      <value>#VARIABLE continentmaptitlepart %concat( "+", %repeat( "-", %eval( (%len( %1)-%len( @continent)-2)/2)), " ", @continent, " ")
#WRITE 1 {%e[37m%concat( @continentmaptitlepart, %repeat( "-", %eval( %len( %1)-%len( @continentmaptitlepart)-1)), "+")}</value>
      <trigger trigontrig="false">
        <pattern>^(+{------------------------------------------------------------|------------------------------}+)$</pattern>
        <value>#WRITE 1 %e[37m%1
#CLOSE 1</value>
      </trigger>
    </trigger>
    <trigger priority="12610" ansi="true" trigontrig="false" regex="true" id="1260">
      <pattern>(\|.*\|)</pattern>
      <value>#WRITE 1 %e[37m%1</value>
    </trigger>
    <trigger priority="12600" trigontrig="false" regex="true" id="1261">
      <pattern>^\{bigmap\}(\d+),(.*)$</pattern>
      <value>#LOCAL filename
$filename=""
#SWITCH (%2) ("The Continent of Mesolar") {$filename=%session.cmudfilename("The_Continent_of_Mesolar.MAP.txt","")} ("The Southern Ocean") {$filename=%session.cmudfilename("The_Southern_Ocean_MAP.txt","")} ("Gelidus") {$filename=%session.cmudfilename("Gelidus_MAP.txt","")} ("The Dark Continent, Abend") {$filename=%session.cmudfilename("The_Dark_Continent_Abend_MAP.txt","")} ("Alagh, the Blood Lands") {$filename=%session.cmudfilename("Alagh_the_Blood_Lands.MAP.txt","")} ("The Uncharted Oceans") {$filename=%session.cmudfilename("The_Uncharted_Oceans_MAP.txt","")}
#GAGON
#ADDKEY continentmapnumbers %1 %2
#VARIABLE continent %2
#FILE 1 $filename
#ERASE 1
#FILE 1 $filename</value>
    </trigger>
    <trigger priority="12620" trigontrig="false" regex="true" id="1262">
      <pattern>^\{/bigmap\}$</pattern>
      <value>#GAGOFF
#T+ bigmapcoords
#SAY %ansi( cyan, bold)"Updated bigmap for "%char( 34)@continent%char( 34)
drawmap @continentnumber @mudxcoord @mudycoord
#CLASS continentupdateinternals 0</value>
    </trigger>
    <trigger priority="12630" trigontrig="false" regex="true" id="1263">
      <pattern>^\{coords\}(-?\d+),(-?\d+),(-?\d+)$</pattern>
      <value>#GAG
#VARIABLE continentnumber %1
#VARIABLE mudxcoord %2
#VARIABLE mudycoord %3</value>
    </trigger>
  </class>
  <var name="currentmap" id="1308">|</var>
  <alias name="drawmap" id="1311">
    <value><![CDATA[#LOCAL filename
$filename=""
#SWITCH (%db( @continentmapnumbers, @previouscontinentnumber)) ("The Continent of Mesolar") {$filename=%session.cmudfilename("The_Continent_of_Mesolar.MAP.txt", "")} ("The Southern Ocean") {$filename=%session.cmudfilename("The_Southern_Ocean_MAP.txt", "")} ("Gelidus") {$filename=%session.cmudfilename("Gelidus_MAP.txt", "")} ("The Dark Continent, Abend") {$filename=%session.cmudfilename("The_Dark_Continent_Abend_MAP.txt", "")} ("Alagh, the Blood Lands") {$filename=%session.cmudfilename("Alagh_the_Blood_Lands.MAP.txt", "")} ("The Uncharted Oceans") {$filename=%session.cmudfilename("The_Uncharted_Oceans_MAP.txt", "")}
#if (%numparam( ) = 3) {
  #VARIABLE continentnumber %1
  #VARIABLE mudxcoord %2
  #VARIABLE lastmudycoord @mudycoord
  #VARIABLE mudycoord %3
  #IF (@continentnumber = @previouscontinentnumber) {
    #VARIABLE previouscontinentline %arrget( currentmap, %eval( @lastmudycoord+2))
    #EXECWIN CONTINENTS {#PSUB @previouscontinentline 0 @currentwidth @reverseycoord @reverseycoord}
    } {
    #VARIABLE previouscontinentnumber @continentnumber
    #CLR CONTINENTS
    #var currentmap %array("")
    #PRI {
      #FILE 3 $filename
      #GAG
      #IF (%filesize( 3) = 0) {
        #CLOSE 3
        #GAG
        updatecontinent
        #ABORT 1
        }
      #LOOP %filesize( 3) {
        currentmap.%i=%read( 3)
        #WINDOW CONTINENTS %e[0m%arrget( currentmap, %i)
        }
      #CLOSE 3
      #GAG
      #VARIABLE currentwidth %eval( %len( %arrget( currentmap, 1))-1)
      #VARIABLE coordinatepadding %repeat( " ", %eval( (@currentwidth-15)/2))
      #WINDOW CONTINENTS " "
      }
    }
  #VARIABLE reversexcoord %eval( @mudxcoord + 1)
  #VARIABLE reverseycoord %eval( %db( @continentmapheights, @previouscontinentnumber)-@mudycoord+1)
  #EXECWIN CONTINENTS {#PSUB "<font color=red>*</font>" @reversexcoord @reversexcoord @reverseycoord @reverseycoord}
  #VARIABLE coordinateline %concat( @coordinatepadding, "Location: ", %format( "&2.0f", @mudxcoord), ", ", %format( "&2.0f", @mudycoord))
  #EXECWIN CONTINENTS {#PSUB @coordinateline 0 %eval( %len( @coordinateline)-1) 0 0}
  }]]></value>
  </alias>
</class>


Any help whatsoever will be greatly appreciated!

Charneus


Last edited by charneus on Tue Jul 15, 2008 11:32 am; edited 1 time in total
Reply with quote
Tech
GURU


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

PostPosted: Tue Jul 15, 2008 7:34 am   
 
The first thing would be to say what doesn't work and how you expect it to? As well as some content to actually trigger it.

In addition you are missing the the open "<" bracket in your code tag.
_________________
Asati di tempari!
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Tue Jul 15, 2008 12:26 pm   
 
Well, for starters, click on the link I put up there. It's too... exhausting to explain in detail, to say the least. But I'll try.

On Aardwolf, we have continents. Within each continent, there is a "bigmap," and that is displayed with the "bigmap" command. An example of what a bigmap would look like is found by typing "vidblainmap" after installing this script. The reason why Vidblain's map is in there is because it's much different than other maps.

What this script does is takes a map, writes all the lines to a file, then returns those lines back into the Continents window, except it also adds your current position on the map. What it does is not even close to what it's supposed to do. Instead of a map, I'm left with "Location: 32, 20 *" (different variations of it, anyway). That's why I put the link up there - so you can see what it's supposed to look like. As for actual text, the only way I can tell you to do that is by logging into Aardwolf, run 2s9e, and it should automatically update. I'd put the map here, but that would mean using a LOT of %ansi(color) functions because it's based on color...

Charneus
Reply with quote
Zugg
MASTER


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

PostPosted: Tue Jul 15, 2008 5:08 pm   
 
It's possible that the problem is still with #PSUB since I still haven't tested that on Aardwolf with the other problems that were reported for it.

But honestly, why are you using #PSUB at all? #PSUB performs substitution on the text that is already displayed to the window. It is slow because it has to fetch the text from the window, then change it, then update the window.

Since you are capturing the data to send to the Continents window into an array, why don't you manipulate the lines *before* they are sent to the Continents window. Like using %subregex or other string functions. That will be much faster and more reliable.

But I'll really try to check the #PSUB command later today to see if it has a bug that is causing this problem.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Jul 15, 2008 9:26 pm   
 
In the drawmap alias:
#PRI {
commands
}
should be reduced to just the commands as #PRIORITY is no longer needed.
I would suggest changing the #ABORT 1 in that section to #EXIT
This:
currentmap.%i=%read( 3)
#WINDOW CONTINENTS %e[0m%arrget( currentmap, %i)
should probably be
#CALL %arrset(currentmap,%read( 3) ,%i)
#WINDOW CONTINENTS %e[0m%arrget( currentmap, %i)

I don't actually see why it needs to hold on to the entire map in memory, also the triggers that preform the capture are only sending it to the file, I would think #CAPping it to the sub window would be appropiate.

You might use the ANSI/VT100 positioning code to eliminate the need of #PSUB, the code is %e[x;yh
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Zugg
MASTER


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

PostPosted: Tue Jul 15, 2008 9:42 pm   
 
I haven't found any problems with #PSUB yet with my testing of this.

Some other "cleanup" suggestions is that you can get rid of most of your %evals. For example:
Code:
#VARIABLE currentwidth %eval( %len( %arrget( currentmap, 1))-1)
#VARIABLE coordinatepadding %repeat( " ", %eval( (@currentwidth-15)/2))

should just be:
Code:
#VARIABLE currentwidth (%len( %arrget( currentmap, 1))-1)
#VARIABLE coordinatepadding %repeat( " ", (@currentwidth-15)/2)

when assigning to a variable or in a command argument, using () performs an %eval, but is much faster. In function arguments (like %repeat above), evaluation is done by default. %eval delays evaluation until runtime, so it's treating the argument as a string and then compiling it and evaluating it at runtime, which is much slower than letting CMUD compile it with the script in the first place.

As far as additional debugging, all I can suggest is using #DEBUG to write messages to the Script Debugger output so that you can monitor what is happening within the script. That will allow you to print the value of your variables at various points in your script without messing up the screen output. For example:

#DEBUG "coordinateline is: " @coordinateline

It's very useful for debugging complex scripts like this.
Reply with quote
FiendishX
Wanderer


Joined: 19 Nov 2005
Posts: 53

PostPosted: Tue Jul 15, 2008 10:43 pm   
 
Quote:
But honestly, why are you using #PSUB at all? #PSUB performs substitution on the text that is already displayed to the window. It is slow because it has to fetch the text from the window, then change it, then update the window.

Since you are capturing the data to send to the Continents window into an array, why don't you manipulate the lines *before* they are sent to the Continents window. Like using %subregex or other string functions. That will be much faster and more reliable.
Because manipulating the array required, I thought, clearing the window and then drawing everything again. Clear and then draw causes an obnoxious redraw flicker on large blocks of text. PSUB solved that problem nicely. I'll look into Vijilante's suggestion of using the positioning code to set the pointer back at the start, though.

Quote:
I don't actually see why it needs to hold on to the entire map in memory
Because I didn't want to keep a file handle open all the time, and I assumed that accessing memory would be faster than accessing the disk. Do correct me if that's an invalid assumption. It's not exactly using a ton of memory.

Quote:
when assigning to a variable or in a command argument, using () performs an %eval, but is much faster. In function arguments (like %repeat above), evaluation is done by default. %eval delays evaluation until runtime, so it's treating the argument as a string and then compiling it and evaluating it at runtime, which is much slower than letting CMUD compile it with the script in the first place.
Does any of this apply to zMUD also?
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Tue Jul 15, 2008 10:51 pm   
 
I thought I had got all the priorities out of there, but it appears I've missed a couple. But let me go into a bit more detail as to what this does, and maybe why it needs to hold it in memory plus the usage of #PSUB (though again, I'm sure there are better ways). Again, I'm just converting this over from a zMUD script. The original author IS Fiendish, and he could probably explain it much better than I could.

The purpose of the bigmap is so you can see where you are on the continent. It helps when you're a bit lost and want to know how to get to the next area. An example of what one of the maps looks like is this:

Code:

{coords}0,31,20
{bigmap}0,The Continent of Mesolar
+------------------------------------------------------------+
|~~~~~~~~~~~~#####~~~#?~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
|~~~~~~~~~~########~##|#~~~~###~~?#~###~#~####^^^?~~~~~~~~~?~|
|~~~~~~~~~~####?..####|######################^^^^~~~~~~~~~~#~|
|~~~~~~~~~#####...####|####?################^^?^#^###~~~~~~~~|
|~~~~~~~########################?#*####*##?###^^^^~~~~~~~~~#~|
|~~~~~~~##############################----------?^########~#~|
|~~~~~~~###########################----#######^^.##########~~|
|~~~~~~#########################################.####### .~~~|
|~~~~~##*%*#########..#############****###*##?##.######...##~|
|~~~~~###*########.....#.#########******#^^#####.###....####~|
|~~~~##############.....?..###?##***?**##^^^^##.....##*###?~~|
|~..##############...^....########****##^?^^^##...##*?*##~~~~|
|~..#####?########..^^..*.#########**###^^^^##....###**#...~~|
|~~.#########*.............?###############^^..##.######....~|
|#~..########..####..#.?..###*##?#*##*#?*###..###.#######...~|
|~~..#######..######################...*###..#........####..~|
|~~~.#######=#####?###########?####..#.#....##.######.#?##~~~|
|~~~..######.#############?*####*#..##...#####*##^^^#...##~~~|
|~~~~.######.######*#?###########?#.##########.########.##~~~|
|~~~~.*#?#*#.######################.##?#*##*##.########...?~~|
|~~~.#######.##?####?##########?*##=#----.####..###?*****.#~~|
|~~..#######...#*##################.#####.#####.###*#**...**~|
|~~.##########.############?####?##.#####.......?##***#.?**#~|
|~~~#######?##.###################..#############**#*?#.#**#~|
|~~###########..##################.##############**#**#.###~~|
|~~~###########.##########?#####?#.#######?#####*******.**#~~|
|~~############.#####^^#?##*######..######...###*?#****.**#~~|
|~~#########?###.##^^?^############.###....#.##**#*****.*?#~~|
|~~##?##########..........#*..####.........##..********.##~~~|
|~~#############.##?^^^##......=....#########*.********.#**~~|
|~~~##^#######?..########?#################*?*.**#**#*##.#*~~|
|~###^^########=###########################***.*****#*##.###~|
|~~##?^###?####.####################-?----...#...***##?#.##~~|
|~~###########..#^#^########|##?##########**..=......###.##~~|
|~~~##########.##^#^^####^^#|####?######***?**...###.....#~~~|
|~~###########.#^^#^^#######|##^########~*****.**####*#*?#~~~|
|~**~~~.~##~##.###~#####~###|#~####~...#**..~...*##########~~|
|~**~.~..~~~~~~###~##~~~~###?#~~~~~.~~.##.~~~...##..#.#####?~|
|~~~~~~~~~~~~~~##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.**.........~~|
|~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
+------------------------------------------------------------+
{/bigmap}


What it looks like in color:


The red asterisk is your current position. The usage of #PSUB in the continents window allows you to move around and the red asterisk will move around with you. If you go east, the asterisk moves east. If you go west, the asterisk goes west. As you can probably tell by the script, there are several different continents (this is just one of them). The script worked great in zMUD. Fiendish even had to do some tweaking to get it to work with vt100 and not just ansi. But as of right now, all that shows is:



So, therefore, you can see it's not doing its intended job. I'll do some of the cleanup, but I'm open to other suggestions. :)

Charneus


Last edited by charneus on Tue Jul 15, 2008 10:52 pm; edited 1 time in total
Reply with quote
Zugg
MASTER


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

PostPosted: Tue Jul 15, 2008 10:51 pm   
 
Yes, using the memory data is faster than accessing the disk, so that part is fine. And I understand better now what you are doing. Yes, clearing and redrawing *would* be a lot slower and cause flicker...I didn't realize that it wasn't doing that.

So I assume that what you are doing is saving the current character at the current position, and then using #PSUB to put the * in the current position and then restore the previous character when you move? Is that how it works?

If so, the problem with using #PSUB might be with the red color tag that you are adding. How do you restore the original color of the original character when you move to a new location?

The %eval issue doesn't apply to zMUD because zMUD re-parses *every* line no matter what, which is why it's scripting is so slow. zMUD doesn't perform any script compiling. The %eval statements are absolutely required for zMUD because zMUD didn't perform evaluation automatically like CMUD does. My suggestions were for improving the conversion of the script to CMUD where you don't need all of the %eval kludges.
Reply with quote
FiendishX
Wanderer


Joined: 19 Nov 2005
Posts: 53

PostPosted: Tue Jul 15, 2008 10:54 pm   
 
Quote:
So I assume that what you are doing is saving the current character at the current position, and then using #PSUB to put the * in the current position and then restore the previous character when you move? Is that how it works?

If so, the problem with using #PSUB might be with the red color tag that you are adding. How do you restore the original color of the original character when you move to a new location?
The entire line is stored, not just the character. So there should be no issue with the red color tags. The entire old line gets put back on the screen, then the red star is put into its new location.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Jul 16, 2008 1:07 am   
 
Ahh, now it all makes sense. I would definitely suggest using the VT100 codes for this instead of #PSUB. A link that give details for all of them is here. The only one you really need is the postitioning, as redrawing the entire line will overwrite anything present. Since you use a #CLR when displaying a new map, and all text displays into the window are controled by your script you don't actually have to worry about cursor positions at the end of the line.

For both zMud and CMud I would reccommend using the %arrset I mentioned above, directly #CAPTURE the map to the window at the same time as capturing it to disk, and also during that capture you should capture it to memory. I would also suggest using a naming convention that can be handled through mininal substitution rather then a complex #IF/#SWITCH series.

For CMud, I would further suggest making all variables use default values, to increase speed.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Wed Jul 16, 2008 1:54 am   
 
Vijilante wrote:
For both zMud and CMud I would reccommend using the %arrset I mentioned above, directly #CAPTURE the map to the window at the same time as capturing it to disk, and also during that capture you should capture it to memory. I would also suggest using a naming convention that can be handled through mininal substitution rather then a complex #IF/#SWITCH series.


Actually, in the original script, the scripting was this:

#FILE 3 %concat( %replace( %right( {%session.zMUDFileName("","")}, 2), "\", "/"), %replace( %replace( %db( @continentmapnumbers, @previouscontinentnumber), ",", ""), " ", "_"), "_MAP.txt")

I changed the session to CMUDFileName, but it didn't want to take too well. It left me with a file called _MAP.txt, despite that it was capturing everything correctly. So, I made it the #SWITCH for easy purposes. However, seeing that my post on syntax checker was answered, I can switch it back to

#FILE 3 %concat( %replace( %right( %session.cMUDFileName("",""), 2), "\", "/"), %replace( %replace( %db( @continentmapnumbers, @previouscontinentnumber), ",", ""), " ", "_"), "_MAP.txt")

Heh... that will take care of the #SWITCHs. :P

Charneus

As an aside, whenever I run the script, I keep getting "invalid number of parameters." Not sure, but wondering if it has anything to do with the %array. The map isn't displaying on the continents whatsoever. And it appears that after switching it back to the %concat business, it doesn't create a file at all... there are no errors being reported, either. *sigh*
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Wed Jul 16, 2008 2:04 am   
 
An addition to this, however, is now it appears to be putting the red asterisk in the right place, however, it's not drawing the map at all. Therefore, all I'm seeing is a bunch of black space with a red asterisk in the middle. :P

Charneus
Reply with quote
FiendishX
Wanderer


Joined: 19 Nov 2005
Posts: 53

PostPosted: Wed Jul 16, 2008 3:36 am   
 
Quote:
For both zMud and CMud I would reccommend using the %arrset I mentioned above
Any reason why? Will it be faster?

Quote:
#CAPTURE the map to the window at the same time as capturing it to disk, and also during that capture you should capture it to memory.
The update routine will be used very infrequently. Like on the order of a few times per year. Is there a reason for doing this other than just because?
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Wed Jul 16, 2008 10:49 pm   
 
An update - I tried running the script using the new #FILE format above, and it kicked out this:

Code:
Opened /, as file 3
Closed C:\Users\0wner\Documents\My Games\CMUD\(\/, on file 3


Obviously very wrong... but not sure what's happening to create that.

Charneus
Reply with quote
FiendishX
Wanderer


Joined: 19 Nov 2005
Posts: 53

PostPosted: Fri Jul 18, 2008 9:21 am   
 
Wow. So doing
Code:
#WINDOW CONTINENTS %arrset( currentmap, %i, %read( 3))
instead of
Code:
currentmap.%i=%read( 3)
#WINDOW CONTINENTS %e[0m%arrget( currentmap, %i)
makes new maps draw very noticeably faster. Why is arrget so slow?
Reply with quote
Zugg
MASTER


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

PostPosted: Fri Jul 18, 2008 6:03 pm   
 
Keep in mind that %array, %arrget and %arrset are actually used to create and manipulate COM-based arrays. These are special arrays used in some Windows COM APIs. They weren't really intended for general purpose arrays. General purpose arrays in CMUD are string lists or database variables, which you can use the currentmap.%i syntax with. For example:
Code:
currentmap.%i=%read( 3)
#WINDOW CONTINENTS %e[0m@currentmap.%i

In CMUD, these use hash tables are are much faster compared to in zMUD.

But I have no idea why %arrget is so slow since I'm just calling the Windows API to retrieve a value from a COM array.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Jul 18, 2008 8:58 pm   
 
I think, in the instance of FiendishX's 2 code examples, it is because of the second one using only 1 COM call and it is eliminating the lookup. CMud would likely see the same gain from that particular change. CMud could actually use string lists successfully where zMud still had problems with list items containing the pipe character, which means that switching to lists in CMud would realize an even greater speed gain.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Liath
Novice


Joined: 25 Aug 2009
Posts: 38

PostPosted: Wed Sep 09, 2009 5:01 pm   
 
Did this ever get successfully converted? I'm tryign to convert over to cMUD, but I want my bigmap! :P I'm a mapping freak and it helps when making the maps in the automapper to know which map I'm on...
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion 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