Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4343868
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:48:54+00:00 2026-05-21T11:48:54+00:00

Good day, I don’t know how to describe my problem (which is more like

  • 0

Good day,

I don’t know how to describe my problem (which is more like a challenge)
but I’ll do my best.

I am working on a text-based game and as your character moves, you get informations such as the room name and below, a description (Lorem ipsum in the example) which is an array of string. I would like to know how to append characters to it. I am actually
trying to display a minimap made of ASCII character. See the second bloc
code for an example.

From:

Room Name Here
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis tempus
orci diam. Curabitur hendrerit augue et lorem vulputate semper. Nullam
aliquam eleifend sapien nec bibendum. Donec accumsan leo eu orci
elementum semper in mollis metus. Ut ipsum diam, suscipit vel bibendum
non, congue eu nisi. Donec justo dolor, scelerisque nec fringilla nec,
aliquet sit amet elit. Morbi elementum pharetra odio, nec accumsan
velit lacinia quis.

[Exits: none]   [Doors: none]

Into:

Room Name Here
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis +-----+
tempus orci diam. Curabitur hendrerit augue et lorem vulputate  |  #  |
semper. Nullam aliquam eleifend sapien nec bibendum. Donec      |#-#-#|
accumsan leo eu orci elementum semper in mollis metus. Ut ipsum |  #  |
diam, suscipit vel bibendum non, congue eu nisi. Donec justo    +-----+
dolor, scelerisque nec fringilla nec, aliquet sit amet elit. Morbi
elementum pharetra odio, nec accumsan velit lacinia quis.

[Exits: none]   [Doors: none]

The game itself is made in VB.NET but a solution in pseudo-code is also
welcomed.

Also, each line’s length is aproximatively the maximum length it must be.

Thank you guys!

Edit:
The desired output must be an array of strings because this data is later send to a client connected using sockets.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T11:48:54+00:00Added an answer on May 21, 2026 at 11:48 am

    If we use an assumption that your line length is 80 characters, Limit the max length of your text line to 70 characters. If the actual length is less than 70 add the difference in spaces to the front of the map data you are wishing to add. This is also dependent on using a monospaced font.

    Dim LineOfText As String = "This is a test text"
    Dim LineOfMap As String = "+------+"
    Dim newLine As String
    
    newLine = LineOfText & LineOfMap.PadLeft(80 - LineOfText.Length)
    

    edit: added arrays, used Courier New Font

    Dim LineOfText(6) As String
    Dim LineOfMap(4) As String
    
    Public Sub CreateArray()
    
        LineOfMap(0) = "+-----+"
        LineOfMap(1) = "|  #  |"
        LineOfMap(2) = "|#-#-#|"
        LineOfMap(3) = "|  #  |"
        LineOfMap(4) = "+-----+"
    
        LineOfText(0) = "  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis tempus"
        LineOfText(1) = "orci diam. Curabitur hendrerit augue et lorem vulputate semper. Nullam"
        LineOfText(2) = "aliquam eleifend sapien nec bibendum. Donec accumsan leo eu orci"
        LineOfText(3) = "elementum semper in mollis metus. Ut ipsum diam, suscipit vel bibendum"
        LineOfText(4) = "non, congue eu nisi. Donec justo dolor, scelerisque nec fringilla nec,"
        LineOfText(5) = "aliquet sit amet elit. Morbi elementum pharetra odio, nec accumsan"
        LineOfText(6) = "velit lacinia quis."
    
        Dim x As Integer
    
        For x = 0 To 4
            LineOfText(x) = LineOfText(x) & LineOfMap(x).PadLeft(80 - LineOfText(x).Length) & vbCrLf
        Next
        For x = 0 To 6
            Label1.Text = Label1.Text & LineOfText(x)
        Next
    End Sub
    

    Edit: You can create a function and grow the array if the number of lines is less than 5 to make sure you have space for the map.

    Public Function CreateArray(text() As String, map() As String) as String()
    
        Dim x As Integer
        If text.Length < map.Length Then
            For x = 0 To map.Count - 1
                If x < text.Count - 1 Then
                    text(x) = text(x) & map(x).PadLeft(80 - text(x).Length) & vbCrLf
                Else
                    Array.Resize(text, text.Count + 1)
                    text(x) = map(x).PadLeft(80) & vbCrLf
                End If
    
            Next
       Else
            For x = 0 To map.Count - 1
                text(x) = text(x) & map(x).PadLeft(80 - text(x).Length) & vbCrLf
            Next
       End If
    
       return text
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good day gurus! I don't know if this is very easy to do but
Good day. In my Drupal site, strange characters appear in text. Like, instead of
Good day. I found the example below, I need to append some more text
Good day to all. I am using zend+smarty, but I don't think the framework
Good Day Guys, I know this may sound like a stupid question. However, I
Good day everyone. This problem was part of another one which it as been
Good day everyone. I am working on a Firefox extension, and I want to
Good day, If I have for example the documents which have the following fields
Good day, I have the following problem: class B extends class A and methods
Good day. I know that in order to save object state in Java I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.