Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > VBScript
| Search | Today's Posts | Mark Forums Read
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 17th, 2014, 07:16 PM
Authorized User
Points: 129, Level: 2
Points: 129, Level: 2 Points: 129, Level: 2 Points: 129, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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




Similar Threads
Thread Thread Starter Forum Replies Last Post
Change VBA Code for a Command Button "Help" ASAP BNW1 Access VBA 1 October 8th, 2013 02:47 PM
MSXSL gives error message for "for" inside "select" ilyaz XSLT 1 December 9th, 2010 05:02 PM
Need Source Code for Book "Visual Basic .NET Scalability" USACoder All Other Wrox Books 1 January 11th, 2010 11:10 AM
Chapter 1 " 'rails' is not recognized as an internal or external command" Fenghuang BOOK: Beginning Ruby on Rails 1 November 18th, 2009 01:08 PM
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.