klaw Posted September 12, 2013 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 20 Reputation: 0 Joined: 08/24/13 Last Seen: September 11, 2015 Share 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 Link to comment Share on other sites More sharing options...
GmOcean Posted September 12, 2013 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 666 Reputation: 93 Joined: 04/27/12 Last Seen: August 17, 2015 Share 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 Link to comment Share on other sites More sharing options...
klaw Posted September 12, 2013 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 20 Reputation: 0 Joined: 08/24/13 Last Seen: September 11, 2015 Author Share Posted September 12, 2013 Now that you mention it, it probably would be easier with doevent. Quote Link to comment Share on other sites More sharing options...
GmOcean Posted September 12, 2013 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 666 Reputation: 93 Joined: 04/27/12 Last Seen: August 17, 2015 Share 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 Link to comment Share on other sites More sharing options...
klaw Posted September 13, 2013 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 20 Reputation: 0 Joined: 08/24/13 Last Seen: September 11, 2015 Author Share 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 Link to comment Share on other sites More sharing options...
GmOcean Posted September 13, 2013 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 666 Reputation: 93 Joined: 04/27/12 Last Seen: August 17, 2015 Share 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 Link to comment Share on other sites More sharing options...
Euphy Posted September 13, 2013 Group: Members Topic Count: 72 Topics Per Day: 0.02 Content Count: 2997 Reputation: 1132 Joined: 05/27/12 Last Seen: June 1, 2017 Share 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 Link to comment Share on other sites More sharing options...
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 XyndorLink to comment
Share on other sites
6 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.