Welcome to the Builder Academy

Question Cancel a Single Event

More
06 Jul 2014 22:52 #4950 by WhiskyTest
A function to cancel a single specific event, I used Ripley's change_duration as the model :)

I also added an "interrupt_events" function which I call in "command_interpreter", so you can have events interrupted or canceled just like how you become un-hidden if you hit enter or do anything else.
Code:
void event_cancel_specific(struct char_data *ch, event_id iId) { struct event * pEvent; struct mud_event_data * pMudEvent = NULL; bool found = FALSE; if (ch->events == NULL) return; if (ch->events->iSize == 0) return; clear_simple_list(); while ((pEvent = (struct event *) simple_list(ch->events)) != NULL) { if (!pEvent->isMudEvent) continue; pMudEvent = (struct mud_event_data * ) pEvent->event_obj; if (pMudEvent->iId == iId) { found = TRUE; break; } } if (found) event_cancel(pEvent); return; }
Code:
void interrupt_events(struct char_data *ch) { /* Cancel events that require player to wait before completion.. * Replace 'eREPAIR' with your own events */ event_cancel_specific(ch, eREPAIR); }

Please Log in or Create an account to join the conversation.

Time to create page: 0.322 seconds