klaw Posted September 12, 2013 Posted September 12, 2013 (edited) I simply don't want to waste my time trying to get this to work this way just to have it not work. I'm new to RO scripting, but you have to start somewhere right? Thanks for reading. mapname,x,y,z script npcname id,{ if(getgmlevel() < .Level) end; mes .n$; mes "What can I do for you?"; switch(select("Start Automated Events:End Automated Events")){ case 1: next; callfunc(startEvents); mes .n$; mes "Automated events started."; close; case 2: next; callfunc(endEvents); mes .n$; mes "Automated events ended."; close; } function eventMgr { OnClock0000: OnClock0600: OnClock1200: OnClock1800: callfunc(event1); OnClock0100: OnClock0700: OnClock1300: OnClock1900: callfunc(event2); OnClock0200: OnClock0800: OnClock1400: OnClock2000: callfunc(event3); OnClock0300: OnClock0900: OnClock1500: OnClock2100: callfunc(event4); OnClock0400: OnClock1000: OnClock1600: OnClock2200: callfunc(event5); OnClock0500: OnClock1100: OnClock1700: OnClock2300: callfunc(event6); } function startEvents { callfunc(eventMgr); } function endEvents { //Not sure how to end them all at once } function script event1 { } function script event2 { } function script event3 { } function script event4 { } function script event5 { } function script event6 { } // -------------------- Configuration -------------------- OnInit: set .aLevel,99; // GM Level to access NPC set .n$,"[Event Manager]"; // NPC's Name setarray .EventMenu[0], //Set Event Names Below event1, // First Events Name event2, // Second Events Name event3, // Third Events Name event4, // Fourth Events Name event5; // Fifth Events Name // Add more events here. callfunc(eventMgr); end; } Edited September 12, 2013 by Xyndor Quote
GmOcean Posted September 12, 2013 Posted September 12, 2013 Yes, and no. It's hard to say, but you have the right idea, unfortunately without knowing how each event both starts and ends, we can't really give you an in depth guide. Though, depending on how each even is scripted, it might be easier to simple, use a doevent / donpcevent command, to just have the actual event NPC, shut off the event. Quote
klaw Posted September 12, 2013 Author Posted September 12, 2013 Now that you mention it, it probably would be easier with doevent. Quote
GmOcean Posted September 12, 2013 Posted September 12, 2013 Yes, and you can even, separate them in your menu by event names, so you can specifically turn each one off. Then, when you need to turn all of them off at once, just have each doevent listed under 1 label. So depending on the amount of events you have, you could be looking at probably a 20-40 line script and thats all. Quote
klaw Posted September 13, 2013 Author Posted September 13, 2013 Got it figured out now. What would be the best way to make the onclock function easier to customize. Example - can I make an onclock array and a nested if to set my events to specific times? Quote
GmOcean Posted September 13, 2013 Posted September 13, 2013 Hmmm, last I checked, I don't think labels were able to be built dynamically. So you may be stuck with doing it the manual way. OnClock0000: OnClock0200: OnClock0400: OnClock0600: doevent XYZ; end; OnClock0800: OnClock1000: OnClock1200: doevent 1; doevent 2; end; Quote
Euphy Posted September 13, 2013 Posted September 13, 2013 It's possible to effectively automate the events by triggering a check OnMinute and storing the events to trigger for each hour as a bit integer (that's exactly what I use in my manager XD). It'll take some time to code, but once it's done you won't have to worry about it again. 1 Quote
Question
klaw
I simply don't want to waste my time trying to get this to work this way just to have it not work. I'm new to RO scripting, but you have to start somewhere right?
Thanks for reading.
if(getgmlevel() < .Level) end;
mes .n$;
mes "What can I do for you?";
switch(select("Start Automated Events:End Automated Events")){
case 1:
next;
callfunc(startEvents);
mes .n$;
mes "Automated events started.";
close;
case 2:
next;
callfunc(endEvents);
mes .n$;
mes "Automated events ended.";
close;
}
function eventMgr {
OnClock0000:
OnClock0600:
OnClock1200:
OnClock1800:
callfunc(event1);
OnClock0100:
OnClock0700:
OnClock1300:
OnClock1900:
callfunc(event2);
OnClock0200:
OnClock0800:
OnClock1400:
OnClock2000:
callfunc(event3);
OnClock0300:
OnClock0900:
OnClock1500:
OnClock2100:
callfunc(event4);
OnClock0400:
OnClock1000:
OnClock1600:
OnClock2200:
callfunc(event5);
OnClock0500:
OnClock1100:
OnClock1700:
OnClock2300:
callfunc(event6);
}
function startEvents {
callfunc(eventMgr);
}
function endEvents {
//Not sure how to end them all at once
}
function script event1 {
}
function script event2 {
}
function script event3 {
}
function script event4 {
}
function script event5 {
}
function script event6 {
}
// -------------------- Configuration --------------------
OnInit:
set .aLevel,99; // GM Level to access NPC
set .n$,"[Event Manager]"; // NPC's Name
setarray .EventMenu[0], //Set Event Names Below
event1, // First Events Name
event2, // Second Events Name
event3, // Third Events Name
event4, // Fourth Events Name
event5; // Fifth Events Name
// Add more events here.
callfunc(eventMgr);
end;
}
Edited by Xyndor6 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.