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
jed
Adept


Joined: 18 Dec 2005
Posts: 246

PostPosted: Sun Apr 15, 2007 5:31 am   

[1.26] %read limitations?
 
I've got this script set up
Code:
#FILE 1 foxbigeq.txt
#var selectedeqrecord 1
#var itemsintextfile ""
#var countup 0
#show This is countup and it should be set to 0 @countup
;#var selectedeqrecord %read( 1, 329)
#show @selectedeqrecord
#until (@found=1) {#show this is i %i;#var selectedeqrecord %read( 1, @countup);#show selectedeqrecord @selectedeqrecord;#SHOW %left( @selectedeqrecord, %pos( ",", @selectedeqrecord)-1);#additem itemsintextfile {%left( @selectedeqrecord, %pos( ",", @selectedeqrecord)-1)};#add countup 1;#show countup in loop @countup;#if (@countup=1200) {#var found 1}}
;#until (@found=1) {#show this is i %i;#var selectedeqrecord %read( 1, %i);#show selectedeqrecord @selectedeqrecord;#SHOW %left( @selectedeqrecord, %pos( ",", @selectedeqrecord)-1);#additem itemsintextfile {%left( @selectedeqrecord, %pos( ",", @selectedeqrecord)-1)};#add countup 1;#show countup in loop @countup;#if (@countup=1200) {#var found 1}}
#show @itemsintextfile
#var found 2
;#SAY first time %read( 1, @countup+1)
;#say countup out of loop @countup
#CLOSE 1

to read a name from a comma delimited file (it's all the characters before the first comma) then take that name and enter it into a string list. This script has worked successfully in the past however, now that I'm trying to get it up and running on my new vista machine it won't run well. It starts out ok, and makes it to record number 329, but just stops reading at that point. It doesn't pull in the name thats the first text before the first comma in record number 330. Any idea why it would quit working mid script?? You can see I've tried a couple ways, but i think the upper #until would be correct...
Reply with quote
jed
Adept


Joined: 18 Dec 2005
Posts: 246

PostPosted: Sun Apr 15, 2007 5:50 am   
 
Here is one of the lines out of the comma delimited file
Quote:
bar of adamant,forgebar,,,,0,inventory,500,15,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,yes,yes,,,,,,,,,,,,,,,,,12/29/2006,jed,,,,,,jedcast,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

It get's hung up on the line after this.. to check, I copied this line and made it the next line in the file, and it still didn't work, which tells me that it likely doesn't have anything to do with the contents of the lines...[/code]
Reply with quote
jed
Adept


Joined: 18 Dec 2005
Posts: 246

PostPosted: Sun Apr 15, 2007 6:24 am   
 
OK it seems that if I remove specific lines from the file, it processes. Here is one set. The glowing sygil was read, but the goblin rations wern't
Quote:
glowing sygil,magicportal,,,,1,inventory,7,1,,,,,,,,,,,,,,,,,77,,,,,magical,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,12/27/2006,jed,,nodrop,,,,jedcast,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
goblin rations,food,,,,0,inventory,0,3,,,,,,,,,,,,,,,,,,,,,,magical,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,12/28/2006,jed,,,,,,jedcast,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

Also if I rerun the file with those gon, these ones get hung up... Honeyed jerky reads, but hovering strongbox doesn't.
Quote:
honeyed jerky,food,,,,0,inventory,0,1,,,,,,,,,,,,,,,,,,,,,,magical,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,12/29/2006,jed,,,,,,jedcast,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
hovering strongbox,container,,,,1,inventory,300,0,,,,,,,,,,,,,,,,,,,,,,magical,,,,yes,,,,,,,,,,yes,,,,,,,,,,,,,,,,,1/13/2007,jed,invis,nodrop,hovers,,,jedcast,,,,,33,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Reply with quote
Tech
GURU


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

PostPosted: Mon Apr 16, 2007 5:22 am   
 
I ran it with the samples you have here and they all worked. What you may do is check the actually file. I generated mine using the #WRITE command. Use a hex editor to see if you have unexpected control character in your file around those records.

Assuming you have showed all of your script here, I would make the following recommendations for your code.

Code:
#FILE 1 foxbigeq.txt
$selectedeqrecord= 1
#var itemsintextfile ""
$countup=0 // I assume you don't this variable after this is over
#show This is countup and it should be set to 0 $countup
;$selectedeqrecord =%read( 1, 329)
#show $selectedeqrecord
#until ($countup=1200) {
  #show this is i %i
  $selectedeqrecord= %read( 1, @countup)
  #show selectedeqrecord $selectedeqrecord
  #SHOW %left( $selectedeqrecord, %pos( ",", $selectedeqrecord)-1)
  #additem itemsintextfile {%left( $selectedeqrecord, %pos( ",", $selectedeqrecord)-1)}
  $countup=$countup+1

  #show countup in loop $countup
  }
;#until (@found=1) {#show this is i %i;#var selectedeqrecord %read( 1, %i);#show selectedeqrecord @selectedeqrecord;#SHOW %left( @selectedeqrecord, %pos( ",", @selectedeqrecord)-1);#additem itemsintextfile {%left( @selectedeqrecord, %pos( ",", @selectedeqrecord)-1)};#add countup 1;#show countup in loop @countup;#if (@countup=1200) {#var found 1}}
#show @itemsintextfile
#var found 2
;#SAY first time %read( 1, @countup+1)
;#say countup out of loop @countup
#CLOSE 1


I basicallyt did two things. Put the countup condition in the until expression instead of setting it explicitly. Used local variables for 'selectedeqrecord' since you don't actually process it elsewhere.
_________________
Asati di tempari!
Reply with quote
jed
Adept


Joined: 18 Dec 2005
Posts: 246

PostPosted: Mon Apr 16, 2007 1:13 pm   
 
Thanks for your response. I've used the code that you posted, there was one @countup still needing to be changed. Thanks for the script change!!!!!
I've opened the file in a hex editor, which I've never used before, so I wasn't sure what to look for, however I did some scanning, and the hex equivalent didnt look any different for the ones that don't work compared to the ones that do work. Again, I don't really know what to look for in the first place other than different patterns. I have a full version of the file here:
http://www.fatchachie.com/FoxFiles/EQ/EQListFolder/foxbigeq.txt
Any chance one of yall could give me some indication of what I should be looking for?
Reply with quote
jed
Adept


Joined: 18 Dec 2005
Posts: 246

PostPosted: Mon Apr 16, 2007 1:28 pm   
 
Hmm. I did two things.
In the foxbigeq.txt file, the first line is a list of all of the column names. I removed this line.
Also, I put a semicolon in front of all of the #show commands to see how fast the script would run...
One of these two things made it work! I don't know if it's just my lucky day, or if there was a problem in one of theh show commands.
Reply with quote
Tech
GURU


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

PostPosted: Mon Apr 16, 2007 5:39 pm   
 
I'm glad you got it working. Although in theory none of those edits should have made a difference.

I ran you file which has 1115 lines (including the header column) so the code should result in a DB record with that many entries. However that doesn't happen I get one with 1093 records (1092, if take out the name column).

There are probably a few reasons for this. First you have some essentially empty records. I found 11 of these.

Code:
,,,,,,inventory,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,03/11/07,jed,,,,,,jedcast,,,,,,,,,,,,,,,,,,,,,,,,,


All the others that were not added were duplicates.

If you want the code I used to check this I can send it to you.

Finally I want to ask since you essentially creating a file based database why aren't you using CMUD database component? Consider doing so in the future. Especially since after the coming DB rewrite you'll have a fully functional and feature rich database.
_________________
Asati di tempari!
Reply with quote
jed
Adept


Joined: 18 Dec 2005
Posts: 246

PostPosted: Mon Apr 16, 2007 9:31 pm   
 
The lines with empty first fields are a function of how i generate them... I haven't quite got that tweaked to the max yet.
As for the database, I had this set up in the database and it worked wonderfully, until it started crashing... Something was wrong where the database would start having 0's and empty fields show up for the nam e... then once that started happening, it would change all of the name fields to that, then the rest of the data would disapear. All this was happening under zmud 7.21 and I just figured id forget about the database, and make a text file version of it... I do really want to have a database version, but i've been a bit skeptical to build it just right now with the impending rewrite of the database system... I didnt want to write it then re write it again....
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Tue Apr 17, 2007 2:33 am   
 
I don't think much of the database component has changed since zmud 7.21, but it never hurts to try and report bugs to the beta forum :p. Either that or utilize COM connections to an access database or SQLITE database via ODBC.
_________________
Zmud Support Library
Zmud Knowledge Base
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