Noob needs help

first of all I want to say hello and thanks in advance. What I’m doing is having the application Indigo check my work schedule on iCal. It’s looking to see if I have a scheduled day off. The types of days off I have are “Vacation Day”, “Comp Day”, “PP day” (personal preference), “A/L Day” (Administrative leave), “Alt. RDO” (another day off in place of one of my weekend days) and “Sick Day”.

I have set out a variable called “out” “out” is the list of events for that day. If “out” contains any of those days it is supposed to change the appropriate variable to true. For example, if I had a vacation day, then the variable “onVacation” is supposed to be changed from false to true.

For some reason, the variable “on(whatever day I used to have off)” is not being changed to true. At the end of the script I entered return out and it shows the list of events from iCal for that given day. So if I had a vacation day for today. Out correctly returns “Vacation Day” but the variable is not changing to true.

Here is the script

--calendars to check for vacation or PTO

set out to ""
--get the start and end timestamps for today
set todayStart to current date
set todayEnd to current date
set time of todayStart to 0
set time of todayEnd to 24 * 60 * 60 - 1

--reset the variables
set onVacation to false
set onALT to false
set onComp to false
set onSick to false
set onALD to false
set onPPD to false
set myEvents to {}

tell application "iCal"
	--compile todays events from each calendar
	set todaysEvents to {}
	repeat with c in (every calendar)
		set todaysEvents to (every event of c where start date ≥ todayStart and start date ≤ todayEnd)
		repeat with current_event in todaysEvents
			set out to out & summary of current_event & ""
			
		end repeat
		
	end repeat
	
	--get relevant information from each calendar into a list
	repeat with anEvent in todaysEvents
		set thisSummary to the summary of anEvent
		set out to out & summary of anEvent
		
		--check to see if there is a vacation event and set the variable
		if out contains "Vacation " then
			set onVacation to true
		else
			set onVacation to false
		end if
		
		--check to see if there is a Alt RDO event and set the variable
		if out contains "Alt. RDO " then
			set onALT to true
		else
			set onALT to false
		end if
		
		--check to see if there is a Comp Day event and set the variable
		if out contains "Comp Day " then
			set onComp to true
		else
			set onComp to false
		end if
		
		--check to see if there is a Sick event and set the variable
		if out contains "Sick Day " then
			set onSick to true
		else
			set onSick to false
		end if
		
		--check to see if there is a A/L Day event and set the variable
		if out contains "A/L Day " then
			set onALD to true
		else
			set onALD to false
		end if
		
		--check to see if there is a PP Day event and set the variable
		if out contains "PP day " then
			set onPPD to true
		else
			set onPPD to false
		end if
	end repeat
end tell

tell application "IndigoServer"
	
	-- This checks to see if variables named "time_onVacation" and etc exist, if not, it creates them
	if not (variable "time_onVacation" exists) then
		make new variable with properties {name:"time_onVacation", value:"false"}
	end if
	if not (variable "time_onPPD" exists) then
		make new variable with properties {name:"time_onPPD", value:"false"}
	end if
	if not (variable "time_onALD" exists) then
		make new variable with properties {name:"time_onALD", value:"false"}
	end if
	if not (variable "time_onComp" exists) then
		make new variable with properties {name:"time_onComp", value:"false"}
	end if
	if not (variable "time_onSick" exists) then
		make new variable with properties {name:"time_onSick", value:"false"}
	end if
	if not (variable "time_onALT" exists) then
		make new variable with properties {name:"time_onALT", value:"false"}
	end if
	
	-- These lines set the variables
	set (value of variable "time_onVacation") to onVacation
	set (value of variable "time_onPPD") to onPPD
	set (value of variable "time_onALD") to onALD
	set (value of variable "time_onALT") to onALT
	set (value of variable "time_onComp") to onComp
	set (value of variable "time_onSick") to onSick
	
end tell


return out

Think I found the problem. Had too many variables. The culprits were theEvents and todaysEvents. Removed todaysEvents and MyEvents and everything seemed to clear up. The variables show true for the appropriate day.