Applescripts with x10 and ichat

I just created this script:

on weather()
	
	set CityCode to 11050
	--temperature format
	
	set t_format to "F"
	
	--voiceover format
	
	set v_format to "A"
	
	--say present condition
	
	set a_format to "Y"
	
	
	
	set IURL to "http://weather.yahooapis.com/forecastrss?w=" & CityCode
	
	
	
	--downloading the file using curl
	
	set file_content to (do shell script "curl " & IURL)
	
	--looking for the line with actual condition
	
	set theText to text ((offset of "yweather:condition" in file_content) + 1) thru -1 of file_content
	
	set sub_1 to text ((offset of "\"" in theText) + 1) thru -1 of theText
	
	
	
	--today conditions found
	
	set actual_condition to text 1 thru ((offset of "\"" in sub_1) - 1) of sub_1
	
	
	
	--looking for actual temperature temperature
	
	set sub_1a to text ((offset of "temp=" in sub_1)) thru -1 of sub_1
	
	set sub_1b to text ((offset of "\"" in sub_1a) + 1) thru -1 of sub_1a
	
	set actual_temp to text 1 thru ((offset of "\"" in sub_1b) - 1) of sub_1b
	
	
	
	if t_format is equal to "C" then
		
		set actual_temp to (5 / 9) * (actual_temp - 32) as integer
		
	end if
	
	
	
	--looking for today forecast
	
	set theText to text ((offset of "yweather:forecast" in file_content) + 1) thru -1 of file_content
	
	set sub_2 to text ((offset of "\"" in theText) + 1) thru -1 of theText
	
	
	
	--maximum and minimum temperatures found
	
	set today_min_temp to word 9 of sub_2
	
	set today_max_temp to word 12 of sub_2
	
	if t_format is equal to "C" then
		
		set today_min_temp to (5 / 9) * (today_min_temp - 32) as integer
		
		set today_max_temp to (5 / 9) * (today_max_temp - 32) as integer
		
	end if
	
	
	
	--looking for today forecast condition (a bit tricky)
	
	set sub_3 to text ((offset of "text" in sub_2) + 1) thru -1 of sub_2
	
	set sub_4 to text ((offset of "\"" in sub_3) + 1) thru -1 of sub_3
	
	return text 1 thru ((offset of "\"" in sub_4) - 1) of sub_4
end weather

using terms from application "iChat"
	
	on message received theMessage from theBuddy for theChat
		
		if theMessage is "current weather" then
			send weather() to theBuddy
			
		else if theMessage is "help" then
			send "current weather, software update, turnon elijahroombedlamp, turnoff elijahroombedlamp, hi, hey, hello" to theBuddy
			
		else if theMessage is "turnon elijahroombedlamp" then
			using terms from application "XTension"
				turnon "elijahroombedlamp"
			end using terms from
			send "elijahroombedlamp has been turned on" to theBuddy
			
		else if theMessage is "turnoff elijahroombedlamp" then
			using terms from application "XTension"
				turnoff "elijahroombedlamp"
			end using terms from
			send "elijahroombedlamp has been turned off" to theBuddy
			
		else if theMessage is "software update" then
			send "Updating... " to theBuddy
			
			activate application "Software Update"
			tell application "System Events"
				tell process "Software Update"
					tell window 1
						repeat until exists sheet 1
							delay 1
						end repeat
						repeat while exists progress indicator 1 of sheet 1
							delay 1
						end repeat
						delay 0.5
						if exists button "Quit" of sheet 1 then
							click button "Quit" of sheet 1
							return
						end if
					end tell
				end tell
				repeat until (exists window "Authenticate" of process "SecurityAgent")
					delay 0.5
				end repeat
				tell window "Authenticate" of process "SecurityAgent"
					tell group 1
						set value of text field 1 to "elijah wood"
						set value of text field 2 to "drummer"
					end tell
					click button "OK" of group 2
				end tell
			end tell
			
			send "Finished Updating Software!" to theBuddy
			
		else if theMessage is "hey" then
			send "Hi!" to theBuddy
			
		else if theMessage is "hi" then
			send "Hey!" to theBuddy
			
		else if theMessage is "hello" then
			send "Hey!" to theBuddy
			
		else
			send "???" to theBuddy
		end if
	end message received
	
end using terms from

When I send an IM like this:
turnon elijahroombedlamp

I get this error:
An error occurred while executing an AppleScript event handler.
Event: Message Received
File: ICHAT.scpt
Error: “elijahroombedlamp” doesn’t understand the «event xtentron» message.

For my x10 I’m using XTension, it does in fact support applescript commands.

Thanks,
Elijah

Model: iMac
Browser: Safari 531.22.7
Operating System: Mac OS X (10.6)

Look at the application’s (XTension’s) scripting dictionary.

I looked but that’s what it said to do.