Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Console - Adventure Game Args

$
0
0
I am trying to make a adventure game via windows Command Console (old school).

I'm able to take basic Take, Look, etc commands but I lack the ability to do 'Args', like:

Take Flashlight
Look Up
etc.
What am I missing?

Current code:
Module Main
    'Public Cmds As New Commands
    Public Prompt As String = "? "
    Public Command As String

    Sub Main()
        Dim Args() As String
        Dim A As Int16

        If Args.Length = 0 Then
            Console.WriteLine("No args!")
            Console.ReadLine()
        Else
            Console.WriteLine(Prompt)

            Command = Console.ReadLine()

            Select Case Command
                Case "Take"
                    If Args.Length = 0 Then
                        Console.WriteLine("Take what?")
                    Else
                        For A = 0 To Args.Length - 1
                            Select Case Args(A).ToString
                                Case "Poop"
                                    Console.WriteLine("You a poop!")
                                    Console.ReadLine()
                                Case "Flashlight"
                                    Console.WriteLine("You took the flashlight!")
                                    Console.ReadLine()
                                Case Else
                                    Console.WriteLine("You took nothing, what the hell?")
                                    Console.ReadLine()
                            End Select
                        Next
                    End If

                    Console.WriteLine(Prompt)
                    Console.ReadLine()
                Case Else
                    Console.WriteLine("Invalid Command")
                    Command = Console.ReadLine()
            End Select
        End If

    End Sub

End Module




poop was a test heh...

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>