Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / String Manupilation

Author
Message
Briere
20
Years of Service
User Offline
Joined: 28th Feb 2005
Location: Amherst New York, United States
Posted: 21st Apr 2005 08:26
im send all my game data in a string, and seperating each peice of data with a *, like it said to do in the DBP docs.

How can i search through the string and record each peice of data?

here is an example of my packet.

Ace Of Spades
20
Years of Service
User Offline
Joined: 6th Mar 2005
Location: Across the ocean
Posted: 21st Apr 2005 09:00
look at the LEN , LEFT$ , AND MID$ functions

Digitalmodr
Coder_David
[Apolloed ]
Briere
20
Years of Service
User Offline
Joined: 28th Feb 2005
Location: Amherst New York, United States
Posted: 21st Apr 2005 09:03
i just did, but i still am a bit confused.

It says mid just extracts a character, but how can i find out how many character are before the asterik.

then once i read the 1st value, how can i tell db to skip the 1st * and move on until the second, and then read only the value after the 1st * but before the 2nd?

then the 3rd, 4th,5th etc.
Ace Of Spades
20
Years of Service
User Offline
Joined: 6th Mar 2005
Location: Across the ocean
Posted: 21st Apr 2005 09:36 Edited at: 21st Apr 2005 09:41
Hopefully this will give you an idea of what to do:



Digitalmodr
Coder_David
[Apolloed ]
Carlitos
21
Years of Service
User Offline
Joined: 8th Jul 2003
Location: United States
Posted: 21st Apr 2005 09:46 Edited at: 21st Apr 2005 09:46
hopefully this will help...



[EDIT] LOL, ahh you posted before me lol

If toast always lands butterside down, and cats always land on their feet, what happens if you strap toast to the back of a cat and drop it?!
Briere
20
Years of Service
User Offline
Joined: 28th Feb 2005
Location: Amherst New York, United States
Posted: 21st Apr 2005 10:14
how can i break out of that loop when im done?
Ace Of Spades
20
Years of Service
User Offline
Joined: 6th Mar 2005
Location: Across the ocean
Posted: 21st Apr 2005 10:32
don't copy it exactly. Get creative, attempt to make a function out of it.

Digitalmodr
Coder_David
[Apolloed ]
Ace Of Spades
20
Years of Service
User Offline
Joined: 6th Mar 2005
Location: Across the ocean
Posted: 21st Apr 2005 10:45 Edited at: 21st Apr 2005 10:48
Ok, im feeling nice(and bored), so here ya go:

FUNCTION:


CALL:


EXAMPLE CODE:


[EDIT]
Will return "Record Number Not Valid" if you enter a record number higher than exists.

Digitalmodr
Coder_David
[Apolloed ]
Briere
20
Years of Service
User Offline
Joined: 28th Feb 2005
Location: Amherst New York, United States
Posted: 21st Apr 2005 12:34
i got my own code working

thanks for the start though.
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 21st Apr 2005 19:00
You could also use the new token commands that are undocumented by TGC at the moment (surprise surprise)



Boo!
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 21st Apr 2005 20:30
THERE ARE TOKEN COMMANDS?!?!?!?!?!?!?!?!?!?!??!

*starts smashng head on table*

My Website:
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 21st Apr 2005 22:12
They are VERY basic and will be revealed in U6 I believe with some other string handling stuff.

There does not appear to be a token count command though, so only really useful if you know in advance how many tokens in your string.

Boo!

Login to post a reply

Server time is: 2025-05-29 06:15:44
Your offset time is: 2025-05-29 06:15:44