Quick Search for:  in language:    
code,makes,irritating,office,assistant,playma
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
Visual Basic Stats

 Code: 3,011,557. lines
 Jobs: 117. postings

 How to support the site

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for Visual Basic
Defrag at certain time
By Michael Nipper on 7/1


Click here to see a screenshot of this code!Extended Find Ver 2
By Roger Gilchrist on 7/1

(Screen Shot)

Y! Module
By NightCrawler on 7/1


Files Comperator (the right way)
By Jarry Claessen on 6/30


Simple UDP example
By Mick Walton on 6/30


CAPS Trigger
By Trevor Burley on 6/30


Auto clip picture
By Kenneth. Jakobsen on 6/30


Click here to see a screenshot of this code!Game of life clone (cool math)
By Johannes B on 6/30

(Screen Shot)

String to CHR()
By Nikhil Raj on 6/30


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

Office97 Assistant Plays Games!!!

Print
Email
 

Submitted on: 12/15/1998
By: Ed Hockaday 
Level: Not Given
User Rating: By 3 Users
Compatibility:VB Script

Users have accessed this code 105750 times.
 
 
     This code makes the irritating office assistant a fun playmate, he play games of Paper, Scissors, Stone...and his expressions change according to your actions!!!!

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

'**************************************
' Name: Office97 Assistant Plays Games!!
'     !
' Description:This code makes the irrita
'     ting office assistant a fun playmate, he
'     play games of Paper, Scissors, Stone...a
'     nd his expressions change according to y
'     our actions!!!!
' By: Ed Hockaday
'
' Assumes:You will need the ietimer.ocx 
'     (from ie4) to get this working, a none t
'     imer version can be easily built using t
'     his code...
'
'This code is copyrighted and has' limited warranties.Please see http://w
'     ww.Planet-Source-Code.com/vb/scripts/Sho
'     wCode.asp?txtCodeId=1219&lngWId;=1'for details.'**************************************

'This bit goes in a form
'To create the form follow these instruc
'     tions
'1 Open word, go to the "tools" menu, se
'     lect "macros" then "Visual Basic Editor"
'     
'2 Make a form, call the form frmFight
'3 Add three Option buttons, call these 
'     optPaper, optScissors and optStone
'make sure the text on them says Paper, 
'     Scissors and Stone respectively
'4 Add two labels, call these lblWinsLos
'     sesDraws and lblTimerObject
'5 Add two Command buttons, call these c
'     mdChosen and cmdExit
'6 Add the additional control "Timer Obj
'     ect" (ietimer.ocx)
'7 Add a timer control to the form call 
'     this tmrTimer
'8 Add the following code to the form
'Note1: This was designed to play agains
'     t clipit assistant but you can use any,
'it is simple to change the animations a
'     nd office97 has a full help file on this
'     
'Note2: To convert in to Visual Basic ju
'     st remove all reference to Assistant in 
'     the form
'code, and follow instructions above (fo
'     r 6 just use the normal VBtimer)
'Note3: You will need the ietimer ocx to
'     get this to work in office97 (it works i
'     n VB without)
'Note4: If you like this code please tel
'     l me at edhockaday@hotmail.com, have fun

'     with it!!!
    Option Explicit
    Dim gVar1
    Dim gVar2
    Dim gDraw As Boolean
    Dim gMessage
    Dim gWins
    Dim gLosses
    Dim gDraws
    Dim gTimerObject
    Dim OptionChosen
    '**************************************
    '*Macros by Ed Hockaday*
    '* 15\12\98*
    '**************************************

Public Sub sDraw()

If gVar1 = gVar2 Then sConvertNumberToText MsgBox "You both chose " & gVar1 gDraws = gDraws + 1 gDraw = True Assistant.Visible = True Assistant.Animation = msoAnimationLookUp End If
End Sub
Public Sub sConvertTextToNumber()
If gVar1 = "Paper" Then gVar1 = 1 ElseIf gVar1 = "Scissors" Then gVar1 = 2 ElseIf gVar1 = "Stone" Then gVar1 = 3 End If
If gVar2 = "Paper" Then gVar2 = 1 ElseIf gVar2 = "Scissors" Then gVar2 = 2 ElseIf gVar2 = "Stone" Then gVar2 = 3 End If
End Sub
Public Sub sConvertNumberToText()
If gVar1 = 1 Then gVar1 = "Paper" ElseIf gVar1 = 2 Then gVar1 = "Scissors" ElseIf gVar1 = 3 Then gVar1 = "Stone" End If
If gVar2 = 1 Then gVar2 = "Paper" ElseIf gVar2 = 2 Then gVar2 = "Scissors" ElseIf gVar2 = 3 Then gVar2 = "Stone" End If
End Sub
Public Sub sVar1Win()
Assistant.Visible = True Assistant.Animation = msoAnimationGetArtsy MsgBox "You win" gWins = gWins + 1 End Sub
Public Sub sVar2Win()
Assistant.Visible = True Assistant.Animation = msoAnimationCharacterSuccessMajor MsgBox "You lose" gLosses = gLosses + 1 End Sub
Public Sub sReconcile()
If gVar1 = 1 Then If gVar2 = 3 Then gMessage = " wraps " sVar1Win ElseIf gVar2 = 2 Then gMessage = " gets cut by " sVar2Win End If
ElseIf gVar1 = 2 Then If gVar2 = 1 Then gMessage = " cuts " sVar1Win ElseIf gVar2 = 3 Then gMessage = " is blunted by " sVar2Win End If
ElseIf gVar1 = 3 Then If gVar2 = 2 Then gMessage = " blunts " sVar1Win ElseIf gVar2 = 1 Then gMessage = " gets wrapped by " sVar2Win End If
End If
End Sub
Public Sub sTimerObject()
If gTimerObject = "Paper" Then gTimerObject = "Stone" ElseIf gTimerObject = "Stone" Then gTimerObject = "Scissors" ElseIf gTimerObject = "Scissors" Then gTimerObject = "Paper" End If
End Sub
Public Sub sLanding()
gVar2 = Int((3 * Rnd) + 1) If gVar2 = 1 Then gVar2 = "Paper" ElseIf gVar2 = 2 Then gVar2 = "Scissors" ElseIf gVar2 = 3 Then gVar2 = "Stone" End If
lblTimerObject.Caption = "Clipit chooses " & gVar2 End Sub
Private Sub cmdChosen_Click()
Assistant.Visible = True Assistant.Animation = msoAnimationIdle gTimerObject = "Paper" gDraw = False gMessage = "" gVar1 = "" 'gVar2 = Int((3 * Rnd) + 1) If gWins = "" Then gWins = "0" If gLosses = "" Then gLosses = "0" If gDraws = "" Then gDraws = "0" If optPaper.Value = True Then gVar1 = 1 ElseIf optScissors.Value = True Then gVar1 = 2 ElseIf optStone.Value = True Then gVar1 = 3 End If
tmrTimer.Interval = 1 End Sub
Private Sub cmdExit_Click()
If gWins < gLosses Then With Assistant .Visible = True .Animation = msoAnimationGetAttentionMajor With .NewBalloon .Heading = "Quit While you're ahead...chicken" .Text = "...come On have another go?" .Labels(1).Text = "Yes!" .Labels(2).Text = "No!" .Mode = msoModeModal OptionChosen = .Show End With
End With
If OptionChosen = 1 Then Exit Sub ElseIf OptionChosen = 2 Then Assistant.Animation = msoAnimationDisappear Assistant.Visible = False MsgBox "Macros by Ed Hockaday - 15\12\98" ' Pass these macros on, but change my na ' me and I will find you and kill you ' Thank you kindly!!! Unload frmFight End If
ElseIf gWins > gLosses Then With Assistant .Visible = True .Animation = msoAnimationGetAttentionMajor With .NewBalloon .Heading = "Hahaha I beat you..." .Text = "...don't you want another go?" .Labels(1).Text = "Yes!" .Labels(2).Text = "No!" .Mode = msoModeModal OptionChosen = .Show End With
End With
If OptionChosen = 1 Then Exit Sub ElseIf OptionChosen = 2 Then Assistant.Animation = msoAnimationDisappear Assistant.Visible = False Unload frmFight End If
ElseIf gWins = gLosses Then With Assistant .Visible = True .Animation = msoAnimationGetAttentionMajor With .NewBalloon .Heading = "Come On it's a draw..." .Text = "...lets finish it..." .Labels(1).Text = "Yes!" .Labels(2).Text = "No!" .Mode = msoModeModal OptionChosen = .Show End With
End With
If OptionChosen = 1 Then Exit Sub ElseIf OptionChosen = 2 Then Assistant.Animation = msoAnimationDisappear Assistant.Visible = False Unload frmFight End If
End If
End Sub
Private Sub tmrTimer_Timer()
sTimerObject lblTimerObject.Caption = gTimerObject tmrTimer.Interval = tmrTimer.Interval + 10 If tmrTimer.Interval > 350 Then tmrTimer.Interval = 0 sLanding sConvertTextToNumber sDraw If gDraw = True Then lblWinsLossesDraws.Caption = gWins & " wins, " & gLosses & " losses, " & gDraws & " draws." Exit Sub End If
sReconcile sConvertNumberToText lblWinsLossesDraws.Caption = gWins & " wins, " & gLosses & " losses, " & gDraws & " draws." MsgBox gVar1 & gMessage & gVar2 End If
End Sub
'*************************************** ' 'This bit goes in the ThisDocument part ' (found in the Microsoft word object fold ' er in the project window...) '************************************** '*Macros by Ed Hockaday* '* 15\12\98* '************************************** Sub docstart()
Dim OptionChosen As Integer With Assistant .Visible = True .Animation = msoAnimationGetAttentionMajor With .NewBalloon .Heading = "Hi..." .Text = "...what To have some fun?" .Labels(1).Text = Chr(34) & "Yeah, OK!" & Chr(34) .Labels(2).Text = Chr(34) & "Not really!" & Chr(34) .Mode = msoModeModal OptionChosen = .Show End With
End With
If OptionChosen = 1 Then frmFight.Show ElseIf OptionChosen = 2 Then No1 End If
End Sub
Private Sub Document_Open()
docstart End Sub
Sub No1()
With Assistant .Visible = True .Animation = msoAnimationCharacterSuccessMajor With .NewBalloon .Heading = "Oh come on..." .Text = "...play With me..." .Labels(1).Text = "Play..." .Labels(2).Text = "Leave..." .Mode = msoModeModal OptionChosen = .Show End With
End With
If OptionChosen = 1 Then frmFight.Show ElseIf OptionChosen = 2 Then Assistant.Animation = msoAnimationDisappear Assistant.Visible = False End If
End Sub
Sub Yes1()
With Assistant .Visible = True .Animation = msoAnimationGetWizardy With .NewBalloon .Heading = "Fuck you small balls..." .Text = "...are you starting With me?" .Labels(1).Text = "Fight" .Labels(2).Text = "Run away" .Mode = msoModeModal OptionChosen = .Show End With
End With
If OptionChosen = 1 Then Fight ElseIf OptionChosen = 2 Then Assistant.Animation = msoAnimationCharacterSuccessMajor End If
End Sub
Sub Fight()
With Assistant .Visible = True .Animation = msoAnimationLookUp End With
'frmFight.Show End Sub
'*************************************** ' ****


Other 7 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Not Given category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
4/28/1999 5:42:00 PM:Rob
Code works great...
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/8/1999 1:00:00 PM:jon
hahahahahahaha! funny stuff. code works 
fine..... I would like to have a go at 
subbing the assistant with my own pic 
;o)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/7/1999 9:03:00 AM:Patti
Loved it.  Code worked fine
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/8/1999 5:13:00 AM:Irman Jamil
Where can I find the ietimer.ocx.
Let 
me know buddy...
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/11/1999 3:11:00 PM:Adam Honek
For all that you need ietimer.ocx...you 
can get it here at 
http://www.biwa.ne.jp/~takeo-mt/ocx/
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/22/1999 6:44:00 PM:IETIMER
If you want IETIMER, you must have 
Internet Explorer 4 with SP2 or higher
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/2/2000 12:38:08 AM:Aa Iksan Aripin
I think I've made the same game, but my 
game based on Indonesian traditional 
gamble, and your code is simplest and 
better than mine.
Great !
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/27/2001 6:54:10 PM:dmaestro
Where can I get ietimer.ocx (I have IE 
5.0)?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/15/2001 2:44:35 PM:Burnin' Flame
Were do i get ietimer? I have IE6.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/24/2002 6:27:50 PM:Python5
for 
ietimer
goto
http://www.dynamiclin
k.host.sk/ocx-files/
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/21/2003 6:04:22 AM:
Dude thats twisted
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | Visual Basic Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.