Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Other Programming > VBScript
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #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
Reply


Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 04:02 PM
Need Source Code for Book "Visual Basic .NET Scalability" USACoder All Other Wrox Books 1 January 11th, 2010 10:10 AM
Chapter 1 " 'rails' is not recognized as an internal or external command" Fenghuang BOOK: Beginning Ruby on Rails 1 November 18th, 2009 12: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



All times are GMT -4. The time now is 02:12 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.