View Single Post
  #1 (permalink)  
Old April 17th, 2014, 07:16 PM
Tandy1000SL GW-BASIC Tandy1000SL GW-BASIC is offline
Authorized User
 
Join Date: Apr 2009
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default Color Coding Text & GW-BASIC "Locate" Command

I am using Windows 8 Script Host for the following VBS Code.

These are the relevant excerpted Command Lines from my VBS File.

NOTE: I am not using the "Option Explicit" Command for this VBS Code. I generally avoid using "Option Explicit"; because, it alters the behaviors of the VBS Commands & Variables & Constants & Error Codes.

QUESTION ONE
?How can I get each Terrain Type Letter Code colored in a specific Color?

I am getting the "Name Redefined" Error 800A0411 for each of the Color Constants.

QUESTION TWO
?How can I create a 24x120 Random Text area within a MsgBox, or other, Window?

QUESTION THREE
?Is this Project better suited for the Command Prompt Programming?

I would have no problem with writing this Project in GW-BASIC on a Pre-Y2K Computer Platform.

Yea...GW-BASIC was a DOS Platform that worked on the Command Prompt Format; and, VBS is primarily works on a Windows Platform and not on the Command Prompt Platform.

QUESTION FOUR
?If Visual BASIC Script isn't capable of this type of Computer Programming Project; then, what Y2K+ Computer Language is capable of this type of Project?

Code:
'VISUAL BASIC SCRIPT WORLD MAP TERRAIN CODE
'W = Water     vbBlue
'D = Dirt     vbMegneta
'R = Rock     vbBlack
'S = Sand     vbCyan
'G = Grass     vbGreen
'F = Flower     vbYellow
'T = Tree     vbRed
'A = Atomic Element     vbWhite

'WORLD MAP GENERATION
'World Map Area = 24 Vertical * 120 Horizontal
'World Terriain = Water/Dirt/Rock/Sand
'Dirt/Rock/Sand = Empty/Grass/Flower/Tree
'Rock = Empty/Atomic Element

Dim ComputerGM     'Variable used for calling Game System Related Computer-Only Procedures
Dim TerrainType     'Variable used by the "WorldTerrain" Function for determing the Type Of Terrain
' Selected
Dim intTerrainType     'the Integer Value of the "TerrainType" Variable
Dim strTerrainType     'the String Value of the "TerrainType" Variable

Constant vbBlack = &h00
Constant vbRed = &Hff
Constant vbGreen = &hFF00
Constant vbYellow = &hFFFF
Constant vbBlue = &hFF0000
Constant vbMagneta = &hFF00FF
Constant vbCyan = &hFFFF00
Constant vbWhite = &hFFFFFF

'WORLD MAP
For Polar = 1 to 24
	For Equator = 1 to 120
		ComputerGM = WorldTerrain
                            Locate Polar,Equator
		Print vbBlue & strTerrainType;
	Next Equator
Next Polar

Function WorldTerrain     'World Map Terrain Selection
	Randomizer = TimeSeeder     'using the "TimeSeeder" Function for generating a Random Seed Number
	Randomize dtmSeed1
	TerrainType = Rnd * 10
	intTerrainType = Int(TerrainType)
	If intTerrainType => 0 and intTerrainType =< 2 Then
		strTerrainType = "W"     'Water
	ElseIf intTerrainType = 3 or intTerrainType = 4 Then
		strTerrainType = "D"     'Dirt
	ElseIf intTerrainType = 5 or intTerrainType = 6 Then
		strTerrainType = "R"     'Rock
	ElseIf intTerrainType => 7 and intTerrainType =< 9 Then
		strTerrainType = "S"     'Sand
	Else
		MsgBox "Error -- 'WorldTerrain' Function" & _
		vbNewLine , , "[VBSplanetology.vbs]"
	End If     'intTerrainType
End Function     'World Terrain
Reply With Quote