Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (TipmyPip, AndrewAMD, NewbieZorro), 16,055 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Better file-reading system #100350
11/28/06 17:41
11/28/06 17:41
Joined: Nov 2004
Posts: 888
B
beegee Offline OP
User
beegee  Offline OP
User
B

Joined: Nov 2004
Posts: 888
Well, I don't like the "file_str_read"-command. In the manual it stands: "Reads text from the file with the given handle into the given string, until a delimiter is reached." Okay it reads until a delimiter. First of all it reads generally one byte from a file. Then it reads until a del. is reached. And that is the negative point. Example: There is a user input, which the player can insert several facts. In some inkeys the player types nothing in.

---------------
Text1
Text2

Text4

Text6
---------------

So there are two user inputs the player wrote nothing in. The programs save it. Later it loads the facts. But the GS-Command as mentioned above does read in all cases first of all one byte from the file. And this doesn't make any sense. Plz. change this.

And here I've programmed a new "file_str_read"-command in c-scrpit:

Code:
 ///////////    *****       Inteligent Text-Reading       *****		//////////

string str_Conversation; string delimit_strS","; // del.string is comma
function file_str_readS(handle, string)
{
var asc_return; var delimit_VarS; str_cpy(string,""); delimit_VarS= str_to_asc(delimit_strS);

while(asc_return != 10) && (asc_return != -1) && (asc_return != delimit_VarS) // read till del. expr.
{
// Read out the next ascII-char
asc_return = file_asc_read(handle);

// Write the char into the string if the expr. is true
if(asc_return!=10) && (asc_return != -1) && (asc_return != 13) && (asc_return != delimit_VarS)
{
str_cpy(str_Conversation, "");
str_for_asc(str_Conversation, asc_return);
str_cat(string,str_conversation);
}
}
}



Much thanks,
Benjamin Gentner


Fratch - Newer statistics panel for GameStudio
Re: Better file-reading system [Re: beegee] #100351
11/29/06 11:13
11/29/06 11:13
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
file_str_read intentionally skips tabs and line feeds at the beginning. But it indeed also skipped over a delimiter in the very first byte. This will be fixed.

Re: Better file-reading system [Re: jcl] #100352
11/29/06 13:30
11/29/06 13:30
Joined: Nov 2004
Posts: 888
B
beegee Offline OP
User
beegee  Offline OP
User
B

Joined: Nov 2004
Posts: 888
Nice to hear this, thanks.


Fratch - Newer statistics panel for GameStudio

Moderated by  aztec, Spirit 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1