Message Board
Message Board > Fenix / Bennu / Gemix / DIV > checking weather a process exists |
October 13, 2006, 23:38 | |
yonni
None 420 posts |
I have a point where I need to end a process of one type (if one of that type exists), however, in the process of checking if this process is there, fenix gives me an error (because it cannot find the process). The code I have is: Code: if(get_id(type gotopoint) > 0) //code end; Is there a better way of going about this (preferably one that does not give errors? ____________ |
# |
October 14, 2006, 13:17 | |
PEader
お前はもう死んでいる 1486 posts |
What is the error message? It seems like a bug if get_id is returning an error. There is a function called exists maybe that can help. I can't find any online documentation for Fenix though so I can't provide a link...
____________ I see 57,005 people. |
# |
October 14, 2006, 14:08 | |
Eckolin
Quite Whiskered 388 posts |
Your code is fine. I bet it's the //code that's causing trouble. Remember that get_id(type <something>) returns a new id every time it is called. In that case you may want to use: Code: if((temp_id = get_id(type something)) > 0) //code end [Edited on October 14, 2006 by Eckolin] ____________ Maker of Games... Wisdom is supreme; therefore get wisdom. Need help with coding? I probably wrote something similar. |
# |
October 14, 2006, 14:43 | |
Sandman
F3n!x0r 1194 posts |
Code: if(get_id(type something) > 0) This is not good, because there could be none of that type. Try this: Code: if(exists(type something)) signal(s_kill,type something); // kills all processes of type something // or other code end int exists(<process_id> || type <process_name>) Returns 1 if <process_id> exists or if there exists at least one process of type <process_name>. Returns 0 otherwise. ____________ BennuWiki Yes, my avatar has grey borders in IE (so get a decent browser) ROOFLEZ ROOFLEZ |
# |
October 14, 2006, 20:28 | |
yonni
None 420 posts |
cheers Sandman, thats exactly what I was looking for.
____________ |
# |
Message Board > Fenix / Bennu / Gemix / DIV > checking weather a process exists