Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2012
    Location
    Wisconsin
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Visual Basic Help

    So I'm making a console ASCII sandbox game in VB, and I've come to a problem. I want there to be a randomly generated world when you start the game, and the worlds are made like this:

    Code:
    7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,6,6,6,6,6,6,6,6,6,6,6,6,6
    7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,6,6,6,6,6,6,6,6,6,6,6,6
    7,7,7,7,1,1,1,1,1,1,1,1,1,1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,6,6,6,6,6,6,6,6,6
    7,7,7,7,1,0,0,0,0,0,0,0,0,1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,6,6,6,6,6,6,6,6
    7,7,7,7,1,0,0,0,0,0,0,0,0,1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,6,6,6,6,6,6,6
    7,7,7,7,1,0,0,0,0,0,0,0,0,1,7,7,7,7,7,7,7,7,7,7,7,7,5,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,6,6,6,6,6,6,6
    7,7,7,7,1,0,0,0,0,0,0,0,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7,7,7,7,7,7,7,7,7,7,5,5,5,9,5,5,5,7,7,7,7,7,7,7,7,7,5,5,7,7,7,7,7,7,7,7,7,7,7,7,5,5,5,5,5,9,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,6
    7,7,7,7,7,7,7,7,7,5,5,5,9,5,9,5,5,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,5,5,9,5,5,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
    7,7,7,7,7,7,7,7,7,7,5,5,5,5,5,9,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,5,5,5,5,5,5,5,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
    7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,5,5,9,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
    7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,5,5,5,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
    7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
    7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
    And I've added this bit of code to my main.vb to generate a random conglomeration of the numbers above in the same 64x22 pattern.

    Code:
    Dim rnd As New Random
    
            For x = 0 To 64
                For y = 0 To 20
                    Dim RndNo As Integer = rnd.Next(0, 8)
                    cCon.WriteToBuffer(RndNo)
                Next
            Next
    But currently it just writes all those numbers to the console before the game starts up, and I have no idea how to make it write to a file that needs to be called "world.map", because after that bit of code, the MapParser reads world.map to start the game.

    Not only that, but I also need it to add the commas. Can anyone help?

    Here's a download link if you want to look into the files yourself because my explanations are awful: http://www.sendspace.com/file/ob36ah

    Thanks

  • #2
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,722
    Thanks
    41
    Thanked 191 Times in 190 Posts
    See if you can get some info out of these links...
    File Class
    StreamWriter Class

    You may want to make a file folder in the C:\ drive to save to, sometimes permissions get hairy when you try to write to C:\.

    Play with that some and post back if you still can't get it.

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •