Results 1 to 7 of 7

Thread: Text Based Game

  1. #1

    Thread Starter
    Registered User Flash d:)'s Avatar
    Join Date
    Nov 2000
    Location
    Michigan
    Posts
    15

    Question

    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!

  2. #2
    Addicted Member DarkMoose's Avatar
    Join Date
    Jul 2000
    Location
    in a box
    Posts
    185
    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.

  3. #3
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341
    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 !

  4. #4

    Thread Starter
    Registered User Flash d:)'s Avatar
    Join Date
    Nov 2000
    Location
    Michigan
    Posts
    15
    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.

  5. #5
    Member
    Join Date
    Aug 2000
    Location
    USA
    Posts
    32

    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!
    -Koralt

  6. #6

    Lightbulb

    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
    Code:
    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:

    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--

  7. #7

    Thread Starter
    Registered User Flash d:)'s Avatar
    Join Date
    Nov 2000
    Location
    Michigan
    Posts
    15

    Talking

    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
  •  



Click Here to Expand Forum to Full Width