PenUltima Online Forum Index Official Core: 096.7
Official Core: 097 2008-02-26
Donate towards the POL web hosting bill!
 POL Home   FAQ   Search    Memberlist   Usergroups    Register    Profile   Log in to check your private messages   Log in
Sending Events - Flexibility

 
Post new topic   Reply to topic    PenUltima Online Forum Index -> General Help 096
Display posts from previous:   

Author Message
Erin



Joined: 29 Jun 2007
Posts: 7

PostPosted: Sat Jul 21, 2007 1:27 am    Post subject: Sending Events - Flexibility Reply with quote

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!

Author Message
OldnGrey



Joined: 04 Feb 2006
Posts: 520

PostPosted: Sat Jul 21, 2007 1:35 am    Post subject: Reply with quote

*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 Sat Jul 21, 2007 1:39 am; edited 1 time in total

Author Message
ncrsn



Joined: 10 Feb 2006
Posts: 172

PostPosted: Sat Jul 21, 2007 1:38 am    Post subject: Reply with quote

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.

Author Message
Erin



Joined: 29 Jun 2007
Posts: 7

PostPosted: Sat Jul 21, 2007 1:42 am    Post subject: Reply with quote

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!

Post new topic   Reply to topic    PenUltima Online Forum Index -> General Help 096 All times are GMT - 4 Hours
Page 1 of 1

 




Powered by phpBB © 2001, 2005 phpBB Group :: Theme & Graphics by GHS & Scott E. Royalty