AIM doesn't like my script, someone tell me why

I need some help with this script. It works fine if you don’t misspell the song name (which was kind of the point of the IF statement)

can someone help me with my script, i’m so close to finishing it.

global blah
global fin
global dif
using terms from application "AOL Instant Messenger (SM)"
	on handle event with screen name inScreenName with message inMsg
		set person to inScreenName
		set request_string to (trim html inMsg)
		if requestatm is 1 then
			send "Sorry, Person requesting song at the moment, Please try later."
		else if requestatm is 0 then
			set requestatm to 1
			tell application "iTunes"
				set fin to (get finish of current track) as real
				tell source "Library"
					tell playlist "Request List"
						if track request_string exists then
							set request_track to track request_string
						else
							tell application "AOL Instant Messenger (SM)"
								send "Sorry, Song not found!" to person
							end tell
						end if
					end tell
				end tell
				set dif to (fin - player position) as real
				delay (dif)
				play request_track
				set fin to (get finish of current track) as real
				set dif to (fin - player position) as real
				delay (dif)
				tell playlist "Party Shuffle"
					play
				end tell
				set requestatm to 0
			end tell
		end if
	end handle event
end using terms from

oh common guys, anyone? anyone?
I’m desparate here.

You mean other than the obvious, right?

I mean, you check to see if the track exists:

                  if track request_string exists then 

and if it doesn’t, you warn the user:

                     tell application "AOL Instant Messenger (SM)" 
                        send "Sorry, Song not found!" to person 
                     end tell 

But then you go on to tell it to play anyway. In other words, the failure to find the track doesn’t prevent you from telling iTunes to play it anyway.

You need to change your error checking to only play request_track if the ‘exists’ statement passes.

oops, I was reorgainizing it and I guess I forgot to switch it back
heres the new script (I kinda stripped it down)

It will work if you type in a real track name, but it will error if you mistype it. So I’m back to square one.

global blah
global fin
global dif

using terms from application "AOL Instant Messenger (SM)"
	on handle event with screen name inScreenName with message inMsg
		set person to inScreenName
		set request_string to (trim html inMsg)
		tell application "iTunes"
			set fin to (get finish of current track) as real
			tell source "Library"
				tell playlist "Request List"
					set request_track to track request_string
				end tell
			end tell
			if request_track exists then
				set dif to (fin - player position) as real
				delay (dif)
				play request_track
				set fin to (get finish of current track) as real
				set dif to (fin - player position) as real
				delay (dif)
				tell playlist "Party Shuffle"
					play
				end tell
			else
				tell application "AOL Instant Messenger (SM)"
					send "Sorry, Song not found!" to person
				end tell
			end if
		end tell
	end handle event
end using terms from

OK I figured out the problem, it was trying to set an undefined variable for the exist statement. I also got it fully working too so now I just have to add features