Go Back   CodingForums.com > :: Computing & Sciences > Computer Programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-01-2012, 12:09 AM   PM User | #1
Saphr0ne
New to the CF scene

 
Join Date: Sep 2012
Location: Wisconsin
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Saphr0ne is an unknown quantity at this point
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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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
Saphr0ne is offline   Reply With Quote
Old 10-01-2012, 02:28 PM   PM User | #2
alykins
Senior Coder

 
alykins's Avatar
 
Join Date: Apr 2011
Posts: 1,608
Thanks: 37
Thanked 183 Times in 182 Posts
alykins will become famous soon enough
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
alykins is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:21 PM.


Advertisement
Log in to turn off these ads.