Click to See Complete Forum and Search --> : Text Based Game
Flash d:)
Nov 18th, 2000, 03:51 PM
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!
DarkMoose
Nov 18th, 2000, 05:32 PM
I am totally confused by yer post...but then i'm a very confusing person...
PsyVision
Nov 19th, 2000, 05:00 AM
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 !
Flash d:)
Nov 19th, 2000, 02:59 PM
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.
Koralt
Nov 19th, 2000, 06:19 PM
First, commands you want to look into:
Left$
Right$
Mid$ 'Both a function and sub ...
InStr
Chr$
Asc
And I don't have time to write more ... sorry!
FatPiper
Nov 22nd, 2000, 07:28 PM
Hey flash!
There's a function called split, and you use it like this:
Split(expression, delimiter, count, comparetype)
This function takes a string and separates it into an array of strings, where expression 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:
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!
Flash d:)
Nov 23rd, 2000, 03:38 PM
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.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.