It is currently Fri Dec 05, 2008 1:27 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Sending Events - Flexibility
PostPosted: Fri Jul 20, 2007 9:27 pm 
Offline

Joined: Fri Jun 29, 2007 10:39 am
Posts: 7
I've been making control scripts for items and would like them to be able to receive custom events. So far the best workaround I've found is to just create a cprop on the item with the script that would be sending the event, and check for it in the item's control loop. This however forces me to make the control loop iterate much much faster than it should otherwise so that it checks the cprop in time.

I tried SendEvent(), and as the manual suggests, it only works for an NPC's control script.

Is there a way to send an event to an item's control script? Or better yet, a way to send an event to any process given the proper process object would be nice!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 20, 2007 9:35 pm 
Offline
Certified POL Expert
User avatar

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 580
*edited*
My ideas were a result of not really reading your question. I had only thought that wait_for_event(120) inside a while loop would be useful. Sorry.


Last edited by OldnGrey on Fri Jul 20, 2007 9:39 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 20, 2007 9:38 pm 
Offline
User avatar

Joined: Fri Feb 10, 2006 12:15 am
Posts: 225
You can send event to any process using script.SendEvent()-method.

IE, in your items controlscript, save its' PID into a cprop (SetObjProperty(item, "PID", GetPID());). Then, on the script you want to send the event from, get the pid and its process (script := GetProcess(GetObjProperty(item, "PID"));). And send any event you want to.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 20, 2007 9:42 pm 
Offline

Joined: Fri Jun 29, 2007 10:39 am
Posts: 7
Awesome, I had just gone to look at the script object and found this too. Shame on me for posting before I read everything. Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl