Author Topic: Event handling functions  (Read 2826 times)

0 Members and 1 Guest are viewing this topic.

Hack-N-Slash

  • Elvin Legion
  • *****
  • Posts: 492
  • Reputation: +0/-0
Event handling functions
« on: May 10, 2004 09:30 am CDT »
How does one make a function that activates when a certain event occurs? Making a loop waiting for a certain value would hog cpu cycles, would it not?
« Last Edit: December 31, 1969 06:00 pm CST by Hack-N-Slash »
[size=200]I am a fat, wealthy, capitalist pig[/size]

UnderGod

  • Centurian Lord
  • ********
  • Posts: 2,691
  • Reputation: +0/-0
(No subject)
« Reply #1 on: May 10, 2004 11:53 am CDT »
Give a bit more explaination of what you are talking about..

Loops do lag greatly.

If it is timed, schedule is your friend.

What exactly are you waiting for?
« Last Edit: December 31, 1969 06:00 pm CST by UnderGod »
"The right man in the wrong place can make all the difference in the world"

Hack-N-Slash

  • Elvin Legion
  • *****
  • Posts: 492
  • Reputation: +0/-0
(No subject)
« Reply #2 on: May 10, 2004 12:44 pm CDT »
I dunno, anything...how about being attacked? I was thinking of some special syntax that'll tell a function to wait until a specified event would occur.

Either that or I have get a good understanding of the data flow in the trpg clientside model so I know where to put an if block waiting for a certain value.

You know those scripts in normal tribes games that have people yell at team changers, or auto-apology scripts(Team damage)? Thats what I'm thinking about.
« Last Edit: December 31, 1969 06:00 pm CST by Hack-N-Slash »
[size=200]I am a fat, wealthy, capitalist pig[/size]

UnderGod

  • Centurian Lord
  • ********
  • Posts: 2,691
  • Reputation: +0/-0
(No subject)
« Reply #3 on: May 10, 2004 12:56 pm CDT »
Well, if it is server side, you could just call the function inside the playerdamage function after damage has been dealt ect.

If i is client-side, you could do a hp check, and if it decreases, call the function..

Unless you are specific, I can't really give you an answer.

You could actually put a do-while loop without causing much lag.. It just depends on what you want.
« Last Edit: December 31, 1969 06:00 pm CST by UnderGod »
"The right man in the wrong place can make all the difference in the world"

Hack-N-Slash

  • Elvin Legion
  • *****
  • Posts: 492
  • Reputation: +0/-0
(No subject)
« Reply #4 on: May 10, 2004 01:00 pm CDT »
Oh wait, writer's event.cs provides something like this... I forgot that.
« Last Edit: December 31, 1969 06:00 pm CST by Hack-N-Slash »
[size=200]I am a fat, wealthy, capitalist pig[/size]