Photo Gallery
Member List
Search
Calendars
FAQ
Ticket List
Log Out
Forums
Register
Login
My Profile
Inbox
Address Book
My Subscription
My Forums
Race Game
Logged in as: Guest
arrSession:exec spGetSession 2,16,37849
Active Users: There are
0
members and
0
guests.
Users viewing this topic: none
Printable Version
All Forums
>>
[Scripting]
>>
Post a VBScript
>> Race Game
Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page:
[1]
Login
Message
<< Older Topic
Newer Topic >>
Race Game -
9/15/2006 6:58:04 PM
fantasydealer
Posts: 1
Score: 0
Joined: 9/15/2006
Status:
offline
'==========================DEFINITIONS============================= '================================================================== Randomize '-------------------------------------------------------Makes the interger picking Random. intrace1 = 0 '----------------------------------------------------Sets racer 1's points at Zero. intrace2 = 0 '----------------------------------------------------Sets racer 2's points at Zero. intmax = 100 '----------------------------------------------------Sets your starting money at 100. intbet = 0 '------------------------------------------------------Sets the bet at default 0. '================================================================== '================================================================== intchoice = InputBox("Pick a racer, 1 or 2") '--------------------Lets you pick your racer. Call Bet() '------------------------------------------------------Brings us to the Betting Sub. '==========================BETING SUB============================== '================================================================== Private Sub Bet() intrace1 = 0 '--------------------------------------------------Sets the points at zero for a new game. intrace2 = 0 '--------------------------------------------------Sets the points at zero for a new game. intbet = InputBox("Place your Bet, Max = " & intmax) '----------Lets you place your bet, and shows your money. If int(intbet) > int(intmax) then Call Bet() '------------------If your bet > money then it makes u bet again. Call Race() '--------------------------------------------------- End Sub '================================================================== '================================================================== '===========================Main Sub=============================== '================================================================== Private Sub Race() intrace1 = intrace1 + int(rnd * 10) + 1 '-----------------------Adds random points between 1 and 10 to racer 1. intrace2 = intrace2 + int(rnd * 10) + 1 '-----------------------Adds random points between 1 and 10 to racer 2. If intrace1 > 50 then '-----------------------------------------Sets the Finish point for racer 1 at 50 points. Call Car1() '-------------------------------------------------Goes to the Racer 1 winning Sub. Exit Sub End If if intrace2 > 50 then '-----------------------------------------Sets the Finish point for racer 1 at 50 points. Call Car2() '-------------------------------------------------Goes to the Racer 2 winning Sub. Exit Sub End If MsgBox("Racer 1 = " & intrace1 & " Racer 2 = " & intrace2) '----Shows the current points for each racer. Call Race() '---------------------------------------------------Loops the Race Sub until a winner is reached. End Sub '================================================================== '================================================================== '==========================Car 1 Wins!============================= '================================================================== Private Sub Car1() MsgBox("Racer 1 wins!") '---------------------------------------Displays a message that Racer 1 Won. If intchoice = 1 then intmax = int(intmax) + int(intbet) '------Gives you money if u bet on Racer 1. If intchoice = 2 then intmax = int(intmax) - int(intbet) '------Takes away money if u did not bet on Racer 1. intplay = inputbox("Do you want to play again? 1=Yes : 2=No") '-Askes u if u want to play again. if intplay = 1 then Call Bet() '--------------------------------Brings you back to the Betting sub to play again. End Sub '================================================================== '================================================================== '=========================Car 2 Wins!============================== '================================================================== Private Sub Car2() MsgBox("Racer 2 Wins!") '---------------------------------------Displays a message that Racer 2 Won. If intchoice = 2 then intmax = int(intmax) + int(intbet) '------Gives you money if u bet on Racer 2. If intchoice = 1 then intmax = int(intmax) - int(intbet) '------Takes away money if u did not bet on Racer 2. intplay = inputbox("Do you want to play again? 1=Yes : 2=No") '-Askes u if u want to play again. If intplay = 1 then Call Bet() '--------------------------------Brings you back to the Betting sub to play again. End Sub '================================================================== '================================================================== '====================================================================================================================== '============================================Created By: FaNtAsY_DeAlEr================================================ '====================================================================================================================== 'I know it is nothing special, and i went a little overboard on the explainations, but i was bored. 'Feel free to add as much to this as you want, just give me some credit for getting it rolling thx.
I am so bored so i thought i might post this.
_____________________________
'========Random V.1=========
'========================
intrandom = int(rnd*10)+1
msgbox("Your number is" & intrandom)
'====Created By: FantasyDealer====
'=========================
Post #: 1
If you found our site useful please link to us
<a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>
.
All Forums
>>
[Scripting]
>>
Post a VBScript
>> Race Game
Page:
[1]
Jump to:
Select a Forum
All Forums
----------------------
[Welcome]
- - Forum Rules
- - Test Posting Messages
- - New Member Area/Introduction
[Scripting]
- - WSH & Client Side VBScript
- - WSH & Client Side VBScript Tutorial
- - Post a VBScript
- - Windows PowerShell
- - ASP
- - ASP.NET
- - Windows Script Components
[General Forum]
- - Other Programming/Scripting Languages
- - Suggestions & Feedback
- - Off-Topic Lounge
New Messages
No New Messages
Hot Topic w/ New Messages
Hot Topic w/o New Messages
Locked w/ New Messages
Locked w/o New Messages
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
Forum Software ©
ASPPlayground.NET
Advanced Edition
2.5.5 ANSI