Trying to make a channel message trigger

Sethric

Active Member
If I had Amadeus in my fleet and he said hello, I want to be able to echo to the console, but, I'm not getting the syntax correct.
Here's an example:
Code:
function main()
{
Event[EVE_OnChannelMessage]:AttachAtom[This:OnChannelMessage]
EVE:ActivateChannelMessageEvents
while  1 == 1
{
if (${Channel.Equal[fleet]} && ${Author.Equal[amadeus]} && ${MessageText.Find[hello]}) 
	{
	echo Ama says hi!
	}
}
}

function Shutdown()
	{
	Event[EVE_OnChannelMessage]:DetachAtom[This:OnChannelMessage]
	}
Thanks for any suggestions, just trying to learn.
I realize I need this snippet to stay running in a loop to watch for messages, and I slapped on a 'while 1 == 1', is that a particularly lame way to loop? I couldnt think of anything much better, is 'while ${Script[thisscript](exists)}' better to use since it'll run as long as the script runs?

Ok, thanks again while I brute force my way through scripting in lavishsoft!
 

Amadeus

The Maestro
Staff member
Code:
function main()
{
	Event[EVE_OnChannelMessage]:AttachAtom[EVE_OnChannelMessage]
	EVE:ActivateChannelMessageEvents
	
	while ${ISXEVE(exists)}
	{
		waitframe
	}
	
	Event[EVE_OnChannelMessage]:DetachAtom[EVE_OnChannelMessage]
}


atom(script) EVE_OnChannelMessage(int64 TimeStamp, string Date, string Time, string Channel, string Author, int AuthorID, string MessageText)
{
	if (${Channel.Equal[fleet]} && ${Author.Equal[amadeus]} && ${MessageText.Find[hello]}) 
	{
		echo Ama says hi!
	}
}
 
Top Bottom