Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, juanex, Grant), 1,018 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
str_read #109385
01/27/07 09:08
01/27/07 09:08
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline OP
Serious User
PrenceOfDarkness  Offline OP
Serious User

Joined: Aug 2004
Posts: 1,305
New York
Currently I'm writing my own load and save script. One of the biggest slow downs is not being able to just read parts of a string. For example say I save all my my skills from my.skill1 to my.skill5 into a string like this "45,356.34,673,56.475,101,". Now lets say I decided I want to turn around and restore the skills, one of the biggest problems is that the string will be read as a whole. file_str_read uses a delimiter (delimit_str), maybe str_read could do the same. So i decided to work around this, I thought i could maybe read the string 1 character at a time. I was right, however I can only do that with str_to_asc. Then I need to convert the ascii back into a character by converting the ascii number first into a string with str_for_asc, and finally into a variable. After that I would store that variable into a string with str_cat, then str_clip the original string and continue on..

If your confused by now (believe me i was also) you'll see that besides saving a lot of lines of code we could speed things up a bit for people writing custom load and save scripts (which for multip-layer games is important).

If you'd like I can post the code of what I described above.


"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Re: str_read [Re: PrenceOfDarkness] #109386
01/27/07 09:50
01/27/07 09:50
Joined: Jun 2003
Posts: 1,017
Germany
T
Thomas_Nitschke Offline
Senior Developer
Thomas_Nitschke  Offline
Senior Developer
T

Joined: Jun 2003
Posts: 1,017
Germany
Agreed. I believe that regular expressions are the resolution for each and every problem with strings, though - can we have some, please?


Formerly known as The Matrix - ICQ 170408644 I've been here for much longer than most people think. So where's my "Expert" status?
Re: str_read [Re: Thomas_Nitschke] #109387
01/27/07 16:42
01/27/07 16:42
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
I dunnow what you mean by "str_read". However, you shouldn't use string functions when saving variables.

Use file_var_read and file_var_write and you're done.


Always learn from history, to be sure you make the same mistakes again...
Re: str_read [Re: Uhrwerk] #109388
01/28/07 09:57
01/28/07 09:57
Joined: Jun 2003
Posts: 1,017
Germany
T
Thomas_Nitschke Offline
Senior Developer
Thomas_Nitschke  Offline
Senior Developer
T

Joined: Jun 2003
Posts: 1,017
Germany
As far as I understood the request, PrenceOfDarkness wanted to have a new function str_read which reads a string "step by step" by using a delimiter. Just as file_str_read, only the string is not read from a file but rather from another string.
I second this, but I think it would be better to simply have some regex operations available, such as
Code:

string some_string = "This is a test";
some_text_object.string = split_str( "/\s+/",some_string );


...and so on.
In the example, the function split_str would use the regular expression provided (this one looks for Spaces in an unlimited number) to cut the string into several pieces and return the pieces as an array.
Such functions would make working with strings a pleasure, I think.


Formerly known as The Matrix - ICQ 170408644 I've been here for much longer than most people think. So where's my "Expert" status?
Re: str_read [Re: Thomas_Nitschke] #109389
01/29/07 16:33
01/29/07 16:33
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline OP
Serious User
PrenceOfDarkness  Offline OP
Serious User

Joined: Aug 2004
Posts: 1,305
New York
that could work also, but my way is good because it would work just like file_str_read, what ever is read could simply be stored.


"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.

Moderated by  aztec, Spirit 

Gamestudio download | chip programmers | 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