|
-
Nov 18th, 2000, 04:51 PM
#1
Thread Starter
Registered User
I have tried to make a graphics game and it was way to complicated so I have decided to make a text based one. What I want to do is store all the text is will display in a text file which it will load and display the text I want from it when the time comes. I know how to splice text but only with one symbol seperating them. What I want is to be able to say that I am here (probably a x,y location that will say where the person is) so display this text in a text box. Did ya get that? Hope so!
-
Nov 18th, 2000, 06:32 PM
#2
Addicted Member
I am totally confused by yer post...but then i'm a very confusing person...
To understand recursion, one must first understand the concept of recursion.
-
Nov 19th, 2000, 06:00 AM
#3
Frenzied Member
I do beleive vb has a Split function to seperate a string by a char that u specify (like .So you could do this.
Open the File For Reading
Use the Replace function to replace $x within that file with the players x and replace $y with the players y, then seperate the string using the split function and voila. P:S, the split function splits up the data into an array !
-
Nov 19th, 2000, 03:59 PM
#4
Thread Starter
Registered User
unfortunatly im relitavly new to vb and need a little help so could you plese give me some sample code? I looked into what you said and I think its what I want.
-
Nov 19th, 2000, 07:19 PM
#5
Member
Frankly, graphics are *easier* ... but ...
First, commands you want to look into:
Code:
Left$
Right$
Mid$ 'Both a function and sub ...
InStr
Chr$
Asc
And I don't have time to write more ... sorry!
-
Nov 22nd, 2000, 08:28 PM
#6
New Member
Hey flash!
There's a function called split, and you use it like this:
Code:
Split(expression, delimiter, count, comparetype)
This function takes a string and separates it into an array of strings, where is the string to be split up (this oculd be your file).
delimiter is a string that indicates what separates the different elements that will be returned
count is used to specify the maximum number of strings/substrings created. default is -1, which means no limit
comparetype defines what kind of comparison is performed: if comparetype is 0 then a binary comparison is performed, and it is Case Sensitive. If you use 1, then it is not case sensitive anymore.
You could probably use this with a For Each loop, like this:
Code:
For each strThing in Split(yourtxtfile,";",-1,1)
intCounter = intCounter + 1
arrArray(intCounter) = strThing
Next
Or something like that. (don't try and copy-paste that, that's more bug-ridden then my oldest pair of socks).
Still though, wish u luck!
|) 4 |\| ( 00 |{
--freestyle--
-
Nov 23rd, 2000, 04:38 PM
#7
Thread Starter
Registered User
Thanks alot. Ill play around with that and if it works I will tell you and if it dosen't well then i'll tell you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|