/******************************************************************************/
(include "sci.sh")
(include "game.sh")
/******************************************************************************/
(script 7)
/******************************************************************************/
(use "Controls")
(use "Cycle")
(use "Door")
(use "Feature")
(use "Game")
(use "Inv")
(use "Main")
(use "Obj")
/******************************************************************************/
(local
	leavetax
)
(instance public rm007 of Rm
	(properties
		picture scriptNumber
		north 0
		east 0
		south 0
		west 0
	)
	(method (init)
		(super:init())
		(self:setScript(RoomScript))
		
		(switch(gPreviousRoomNumber)
			(default
				(send gEgo:
					posn(120 170)
					loop(1)
				)
			)
		)
			Display(
    @firstname
    dsCOORD 40 28
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
)
Display(
    @lastname
    dsCOORD 147 28
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
					   )
					   Display(
    @wages
    dsCOORD 275 84
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
					   )
					   Display(
    @interest
    dsCOORD 275 98
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
					   )
					   Display(
    @unemployment
    dsCOORD 275 112
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
					   )
					   Display(
    @linefour
    dsCOORD 275 126
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
					   )
					   Display(
    @linesix
    dsCOORD 277 178
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
)
					   
					   

		
		SetUpEgo()
	
	
	)
)
/******************************************************************************/
(instance RoomScript of Script
	(properties)

	(method (doit)
		(super:doit())
		
		// code executed each game cycle
	)

	(method (handleEvent pEvent)
		(super:handleEvent(pEvent))
		(if(Said('check'))
			(if(== STRINGS_EQUAL StrCmp("20" @interest))
				(send gGame:changeScore(3))
			)
			(if(== STRINGS_EQUAL StrCmp("name" @lastname))
				(send gGame:changeScore(3))
			)
		
	(if(== STRINGS_EQUAL StrCmp("given" @firstname))
				(send gGame:changeScore(3))
	)
		(if(== STRINGS_EQUAL StrCmp("440" @wages))
				(send gGame:changeScore(3))
			)
	
		)	
	
		 (if (== evMOUSEBUTTON (send pEvent:type))
              	(if(== $0200 OnControl(ocSPECIAL (send pEvent:x) (send pEvent:y)))
	      	   			   	   		
	      	   		
	     		   		
	  		EditPrint(@firstname 14 "Your first name:" #at 70 40 )
	  	Display(
    @firstname
    dsCOORD 40 28
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
)
               
			

			
				)
				(if(== $0100 OnControl(ocSPECIAL (send pEvent:x) (send pEvent:y)))
						EditPrint(@lastname 14 "Your last name:" #at 70 40 )
                Display(
    @lastname
    dsCOORD 147 28
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
					   )
				)
					   

              	(if(== $0800 OnControl(ocSPECIAL (send pEvent:x) (send pEvent:y)))
              	
              		EditPrint(@wages 14 "Your total wages n' salaries. Plus the many tips you receive sexing bones." #at 270 80 )
              		 Display(
    @wages
    dsCOORD 275 84
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
					   )
				)
               	(if(== $1000 OnControl(ocSPECIAL (send pEvent:x) (send pEvent:y)))
              	
              		EditPrint(@interest 14 "Taxable interest:" #at 270 86 )
              		 Display(
    @interest
    dsCOORD 275 98
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
					   )
				)
				(if(== $2000 OnControl(ocSPECIAL (send pEvent:x) (send pEvent:y)))
              	
              		EditPrint(@unemployment 14 "Unemployment compensation:" #at 270 94 )
              		 Display(
    @unemployment
    dsCOORD 275 112
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
					   )
				)
				(if(== $4000 OnControl(ocSPECIAL (send pEvent:x) (send pEvent:y)))
              	
              		EditPrint(@linefour 14 "Put 1 n' 2 n' 3 together:" #at 270 102 )
              		 Display(
    @linefour
    dsCOORD 275 126
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
					   )
				)
				
              	(if(== $0008 OnControl(ocSPECIAL (send pEvent:x) (send pEvent:y)))
	      	   			   	   		
	      	   		
	     		   		
	  		EditPrint(@linesix 14 "Subtract line 5 from line 4. If line 5 is larger than line 4, enter 0. This is your taxable income." #at 270 140 )
	  	Display(
    @linesix
    dsCOORD 277 178
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
)
				)
          (if(== $0020 OnControl(ocSPECIAL (send pEvent:x) (send pEvent:y)))
          	(send gRoom:newRoom(9))
		  )      	
				
			  (if(== $0001 OnControl(ocSPECIAL (send pEvent:x) (send pEvent:y)))
					Print("Not MEOW!")
			  )
              
	      	   		
			  
	      	   		
		 )
				(if(Said('leave, finish, exit, stop'))
					(while(1)
  					= leavetax Print(
  						"Would you like to make your changes permanent?"
  						#title "R U Dun 4 Gud?"
  						#font gDeadFont
  						#button "Nes"  1
  						#button "Yo"  2
  						
  					)
  					(switch(leavetax)
  						(case 1
  						= duntaxes 1
  							= gNormalCursor 152
			(send gGame:setCursor(gNormalCursor SET_CURSOR_VISIBLE 304 174))
  						Print("You stuff the form into its pre-addressed envelope and wrestle the flap closed.")
  						(send gEgo:get(INV_ENVELOPE))
  						(send gRoom:newRoom(4))
  						return
  							)
					
		    			(case 2
		    			= firstname 0
		    			= lastname 0
		    			= wages 0
		    			= interest 0
		    			= unemployment 0
		    			= linefour 0
		    			= linesix 0
	 	= gNormalCursor 152
			(send gGame:setCursor(gNormalCursor SET_CURSOR_VISIBLE 304 174))
	
  						(send gRoom:newRoom(4))
  						return
		    			)
		    		
					)
					)
				)
		// handle Said's, etc...
	)

	(method (changeState newState)
		(= state newState)
		(switch (newState)
			(case 0
				// Handle state changes
			)
		)
	)
)
/******************************************************************************/