|
You last visited: Today at 19:10
Advertisement
[HELP] Time Setting in Event
Discussion on [HELP] Time Setting in Event within the Rappelz Private Server forum part of the Rappelz category.
02/20/2013, 00:50
|
#1
|
elite*gold: 0
Join Date: Feb 2013
Posts: 15
Received Thanks: 1
|
[HELP] Time Setting in Event
Using "time setting" do not work in my custom event.
For example, I want to start the event at 12:00 and finish at 18:00 everyday.
I'm making like this.
Code:
function event()
local current_time = os.date( "%H:%M:%S" )
time_1 = '12:00:00'
time_2 = '18:00:00'
if current_time < time_1 then
event_begin()
elseif current_time < time_2 then
event_end()
end
end
function event_begin()
...///
But don't work. Whta is wrong? Please give me an advice if you know somothing about this. Thank you.
|
|
|
02/20/2013, 01:09
|
#2
|
elite*gold: 0
Join Date: Oct 2010
Posts: 2,555
Received Thanks: 2,458
|
How are you triggering that there function? o_O
|
|
|
02/20/2013, 01:30
|
#3
|
elite*gold: 0
Join Date: Feb 2013
Posts: 15
Received Thanks: 1
|
Quote:
Originally Posted by ismokedrow
How are you triggering that there function? o_O
|
I'm making the event just for test now.
What I'm making is if its after 12:00, players can receive GM buffs from NPC in Hidden Village.
Code:
function get_module_name()
return "NPC_Buff"
end
function event()
local current_time = os.date( "%H:%M:%S" )
time_1 = '12:00:00'
time_2 = '18:00:00'
if current_time < time_1 then
event_begin()
elseif current_time < time_2 then
event_end()
end
end
function event_begin()
local npc_id = get_npc_id()
if npc_id == 11225 then
dlg_title("@90702501")
else
dlg_title("@90702501")
end
add_state(314017, 70, 360000)
NPC_Hidden_Village_Buff()
else
dlg_text("@90010005")
dlg_menu("@90010002", "")
dlg_show()
end
function event_end()
local npc_id = get_npc_id()
if npc_id == 11225 then
dlg_title("@90702501")
else
dlg_title("@90702501")
end
dlg_text("event is closing")
dlg_menu("@90010002", "")
dlg_show()
end
Just like this.
|
|
|
02/20/2013, 01:48
|
#4
|
elite*gold: 0
Join Date: Oct 2010
Posts: 2,555
Received Thanks: 2,458
|
Oh I see what you did there, I'm not real positive on the whole os.time bit there. But why not go the simple route and just set the NPC to be period (is_periodic = TRUE) then you set begin/end date and the NPC will only show up between those two dates at the time specified.
|
|
|
02/20/2013, 02:12
|
#5
|
elite*gold: 0
Join Date: Feb 2013
Posts: 15
Received Thanks: 1
|
Quote:
Originally Posted by ismokedrow
Oh I see what you did there, I'm not real positive on the whole os.time bit there. But why not go the simple route and just set the NPC to be period (is_periodic = TRUE) then you set begin/end date and the NPC will only show up between those two dates at the time specified.
|
Thank you for your advice. I know using "is_periodic" is easy to make event but I want to open that event everyday. If I use "is_periodic", the NPC shows only that day (begin_of_period) to (end_of_period). I put only time in the table but it will change to 2013-02-20 00:00:00.000 automatically. So I use that function
|
|
|
02/20/2013, 09:28
|
#6
|
elite*gold: 0
Join Date: Jul 2011
Posts: 264
Received Thanks: 240
|
Quote:
Originally Posted by monoedge
Using "time setting" do not work in my custom event.
For example, I want to start the event at 12:00 and finish at 18:00 everyday.
I'm making like this.
Code:
function event()
local current_time = os.date( "%H:%M:%S" )
time_1 = '12:00:00'
time_2 = '18:00:00'
if current_time < time_1 then
event_begin()
elseif current_time < time_2 then
event_end()
end
end
function event_begin()
...///
But don't work. Whta is wrong? Please give me an advice if you know somothing about this. Thank you.
|
did you try to use the %X function it is easier than the %H:%M:%S
it give you the full time "e.g.,12:52:14" the code will look like this
Code:
function event()
local current_time = os.date( "%X" )
time_1 = '12:00:00'
time_2 = '18:00:00'
if current_time < time_1 then
event_begin()
elseif current_time < time_2 then
event_end()
end
end
function event_begin()
...///
i didn't try it but i think it will work and take a look at this
hope this help you
Greets,
HawasMan
|
|
|
02/20/2013, 13:12
|
#7
|
Moderator
elite*gold: 1
Join Date: Dec 2012
Posts: 4,780
Received Thanks: 1,462
|
If that does not work you could try setting it up like a daily quest, with some cool time associated with it.
That way each player can take advantage of it once per day, not mattering which time of day they do it but then will not be able to do it again for 24 hour cool down.
You could check the pet grooming functions in the Creature Farm and maybe apply some of that code that only lets a player groom a pet once a day and also only lets them get buffed once per day.
|
|
|
02/20/2013, 13:28
|
#8
|
elite*gold: 0
Join Date: Jun 2010
Posts: 573
Received Thanks: 163
|
Maybe this snippet can give you a clue. I guess it isn't from Raskim cause there are some references to xijezu in this file. Since he retired i guess it doesn't really matter. If it's from Raskim it doesn't matter either, cause he used some of my **** too
Code:
function lucky_raskim_contact_event()
local flag = tonumber( get_flag("lucky_raskim") ) -- get the timespan of the last recieve
if flag == nil then -- if not exists
flag = 0 -- set flag to 0
set_flag( "lucky_raskim", "0" )
end
if flag+1 < os.time(t) then -- if last-recieve-time + 1 hour is smaller than current time
dlg_title("Lucky Raskim")
dlg_text("Hey, ich bin Raskim. Ich verteile Geschenke an alle Meister Klassen, jedoch nur alle 10 Stunden.")
dlg_menu("Was sind die Regeln?","lucky_npc_rules()")
dlg_menu("Ich möchte das geschenk erhalten","lucky_npc_recieve_gift()")
dlg_menu("TestFunktion","lua_to_sql_test()")
dlg_menu("Auf wiedersehen","")
dlg_show()
else
whisper(gv("name"),os.date ("<b>Du kannst das naechste Geschenk am %d.%m.%Y um %H:%M abholen. Wir sehen uns.", flag+36000))
end
end
ofc there is another part with
Code:
set_flag("lucky_raskim", os.time(t))
after recieving the specific item to save the datetime
|
|
|
02/20/2013, 19:53
|
#9
|
elite*gold: 0
Join Date: Feb 2013
Posts: 15
Received Thanks: 1
|
Quote:
Originally Posted by M>M
did you try to use the %X function it is easier than the %H:%M:%S
it give you the full time "e.g.,12:52:14" the code will look like this
Code:
function event()
local current_time = os.date( "%X" )
time_1 = '12:00:00'
time_2 = '18:00:00'
if current_time < time_1 then
event_begin()
elseif current_time < time_2 then
event_end()
end
end
function event_begin()
...///
i didn't try it but i think it will work and take a look at this
hope this help you
Greets,
HawasMan
|
Thank you for your advice. But %X still seems not work. I'll try another ways. Probably something is wrong in my code. Maybe I should try to fix them first and then I'll use %X.
Quote:
Originally Posted by thndr
If that does not work you could try setting it up like a daily quest, with some cool time associated with it.
That way each player can take advantage of it once per day, not mattering which time of day they do it but then will not be able to do it again for 24 hour cool down.
You could check the pet grooming functions in the Creature Farm and maybe apply some of that code that only lets a player groom a pet once a day and also only lets them get buffed once per day.
|
Mmm. I think using cool time is better idea than mine. I guess the code which haxti gave me is also like cool time so I'll try to use it.
Anyway thank you for your advice.
Quote:
Originally Posted by haxti
Maybe this snippet can give you a clue. I guess it isn't from Raskim cause there are some references to xijezu in this file. Since he retired i guess it doesn't really matter. If it's from Raskim it doesn't matter either, cause he used some of my shit too
Code:
function lucky_raskim_contact_event()
local flag = tonumber( get_flag("lucky_raskim") ) -- get the timespan of the last recieve
if flag == nil then -- if not exists
flag = 0 -- set flag to 0
set_flag( "lucky_raskim", "0" )
end
if flag+1 < os.time(t) then -- if last-recieve-time + 1 hour is smaller than current time
dlg_title("Lucky Raskim")
dlg_text("Hey, ich bin Raskim. Ich verteile Geschenke an alle Meister Klassen, jedoch nur alle 10 Stunden.")
dlg_menu("Was sind die Regeln?","lucky_npc_rules()")
dlg_menu("Ich möchte das geschenk erhalten","lucky_npc_recieve_gift()")
dlg_menu("TestFunktion","lua_to_sql_test()")
dlg_menu("Auf wiedersehen","")
dlg_show()
else
whisper(gv("name"),os.date ("<b>Du kannst das naechste Geschenk am %d.%m.%Y um %H:%M abholen. Wir sehen uns.", flag+36000))
end
end
ofc there is another part with
Code:
set_flag("lucky_raskim", os.time(t))
after recieving the specific item to save the datetime
|
This code must be nice help for me if it works fine. So I'm gonna test it. I think the code which I made is something wrong cuz your time setting (%d.%m.%Y %H:%M) works well in your code.
Thank you very much.
|
|
|
02/20/2013, 20:33
|
#10
|
elite*gold: 0
Join Date: Nov 2011
Posts: 978
Received Thanks: 1,011
|
Quote:
Originally Posted by haxti
Maybe this snippet can give you a clue. I guess it isn't from Raskim cause there are some references to xijezu in this file. Since he retired i guess it doesn't really matter. If it's from Raskim it doesn't matter either, cause he used some of my shit too
Code:
function lucky_raskim_contact_event()
local flag = tonumber( get_flag("lucky_raskim") ) -- get the timespan of the last recieve
if flag == nil then -- if not exists
flag = 0 -- set flag to 0
set_flag( "lucky_raskim", "0" )
end
if flag+36000 < os.time(t) then
dlg_title("Lucky Raskim")
dlg_text("Hey, ich bin Raskim. Ich verteile Geschenke an alle Meister Klassen, jedoch nur alle 10 Stunden.")
dlg_menu("Was sind die Regeln?","lucky_npc_rules()")
dlg_menu("Ich möchte das geschenk erhalten","lucky_npc_recieve_gift()")
[B]dlg_menu("TestFunktion","lua_to_sql_test()")[/B] --shit D
dlg_menu("Auf wiedersehen","")
dlg_show()
else
whisper(gv("name"),os.date ("<b>Du kannst das naechste Geschenk am %d.%m.%Y um %H:%M abholen. Wir sehen uns.", flag+36000))
end
end
ofc there is another part with
Code:
set_flag("lucky_raskim", os.time(t))
after recieving the specific item to save the datetime
|
Oh and next time use the right snippet
|
|
|
02/20/2013, 21:23
|
#11
|
elite*gold: 0
Join Date: Feb 2013
Posts: 15
Received Thanks: 1
|
I edited the code but I can receive item anytime although its within 10 hrs. I added flag after receiving item like the code below but no work whisper.
Sorry again but where am I wrong? lucky_raskim:1361388956 added in the flag_list anyway.
I believe this code means players can receive item every 10 hrs, right?
Code:
function lucky_raskim_contact_event()
local flag = tonumber( get_flag("lucky_raskim") ) -- get the timespan of the last recieve
if flag == nil then -- if not exists
flag = 0 -- set flag to 0
set_flag( "lucky_raskim", "0" )
end
if flag+1 < os.time(t) then -- if last-recieve-time + 1 hour is smaller than current time
dlg_title("Lucky Raskim")
dlg_text("Hey, ich bin Raskim. Ich verteile Geschenke an alle Meister Klassen, jedoch nur alle 10 Stunden.")
dlg_menu("Ich möchte das geschenk erhalten","lucky_npc_recieve_gift()")
dlg_menu("Auf wiedersehen","")
dlg_show()
else
whisper(gv("name"),os.date ("<b>Du kannst das naechste Geschenk am %d.%m.%Y um %H:%M abholen. Wir sehen uns.", flag+36000))
end
end
function lucky_npc_recieve_gift()
insert_item( 3600289, 1 )
set_flag("lucky_raskim", os.time(t))
dlg_text("Hey, ich bin Raskim. Ich verteile Geschenke an alle Meister Klassen, jedoch nur alle 10 Stunden.")
dlg_menu( "@90010001", " " )
end
|
|
|
02/20/2013, 23:14
|
#12
|
elite*gold: 0
Join Date: Nov 2011
Posts: 978
Received Thanks: 1,011
|
If youre using the 8.1 GS, dont wonder, it changed.
YOu cant use this way with the 8.1 GS any longer.
|
|
|
02/21/2013, 03:13
|
#13
|
elite*gold: 0
Join Date: Jun 2010
Posts: 573
Received Thanks: 163
|
Quote:
Originally Posted by TheOnlyOneRaskim
Oh and next time use the right snippet
|
Oh you should prolly shut up 'bout failed dreams man And it is the right snippet. It's about handling datetime format and time addition.
And I won't start about the 100 copy paste lines in this file
|
|
|
Similar Threads
|
Hot Time Event
11/13/2012 - Combat Arms - 3 Replies
Hey,
Wie einige von euch gemerkt haben, gab es vom 6-9.November bei jedem Log-in zwischen 18-20 Uhr, eine MYST-N (1 mal pro Tag)
Das nähste ist am 16.November. Nur damit ihr es nicht vergesst.
Ja, ein Thread ist dafür nötig, im TT würde das nur wieder untergehen.
Quelle:
http://en.combatarms.nexoneu.com/article.aspx?idx =Tm90aWNlfDIyMzM=
|
How I Change Time Unique Event
03/09/2012 - SRO Private Server - 0 Replies
Hey guys i want Change Time Unique Event i need this uniques appeard every 1H please guys tell me how i do it please i will die if i dont know:D
|
[Help]Setting time for legwar,pkt and family war
06/28/2010 - EO PServer Hosting - 13 Replies
i need some help to set a time for legwar,pkt and family war..
where can i set it??
|
Rsro event 16.06.2010 20 moscow time
06/19/2010 - Silkroad Online - 6 Replies
So... show me the drops u guys got... post some pics
|
All times are GMT +2. The time now is 19:10.
|
|