Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Rappelz > Rappelz Private Server
You last visited: Today at 19:07

  • Please register to post and access all features, it's quick, easy and FREE!

 

[HELP] Time Setting in Event

Reply
 
Old   #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.



monoedge is offline  
Old   #2
 
elite*gold: 0
Join Date: Oct 2010
Posts: 2,557
Received Thanks: 2,411
How are you triggering that there function? o_O


ismokedrow is offline  
Old   #3
 
elite*gold: 0
Join Date: Feb 2013
Posts: 15
Received Thanks: 1
Quote:
Originally Posted by ismokedrow View Post
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.
monoedge is offline  
Old   #4
 
elite*gold: 0
Join Date: Oct 2010
Posts: 2,557
Received Thanks: 2,411
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.


ismokedrow is offline  
Old   #5
 
elite*gold: 0
Join Date: Feb 2013
Posts: 15
Received Thanks: 1
Quote:
Originally Posted by ismokedrow View Post
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
monoedge is offline  
Old   #6
 
elite*gold: 0
Join Date: Jul 2011
Posts: 264
Received Thanks: 233
Quote:
Originally Posted by monoedge View Post
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
M>M is offline  
Old   #7
Moderator
 
elite*gold: 1
Join Date: Dec 2012
Posts: 3,005
Received Thanks: 961
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.
ThunderNikk is offline  
Old   #8
 
elite*gold: 0
Join Date: Jun 2010
Posts: 573
Received Thanks: 161
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
haxti is offline  
Old   #9
 
elite*gold: 0
Join Date: Feb 2013
Posts: 15
Received Thanks: 1
Quote:
Originally Posted by M>M View Post
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 View Post
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 View Post
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.
monoedge is offline  
Old   #10
 
elite*gold: 0
Join Date: Nov 2011
Posts: 980
Received Thanks: 1,007
Quote:
Originally Posted by haxti View Post
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
You must register and activate your account in order to view images.

Oh and next time use the right snippet
TheOnlyOneRaskim is offline  
Old   #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
monoedge is offline  
Old   #12
 
elite*gold: 0
Join Date: Nov 2011
Posts: 980
Received Thanks: 1,007
If youre using the 8.1 GS, dont wonder, it changed.

YOu cant use this way with the 8.1 GS any longer.
TheOnlyOneRaskim is offline  
Old   #13
 
elite*gold: 0
Join Date: Jun 2010
Posts: 573
Received Thanks: 161
Quote:
Originally Posted by TheOnlyOneRaskim View Post
You must register and activate your account in order to view images.

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


haxti is offline  
Reply



« Previous Thread | Next Thread »

Similar Threads
Hot Time Event
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...
3 Replies - Combat Arms
How I Change Time Unique Event
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
0 Replies - SRO PServer - Discussions / Questions
[Help]Setting time for legwar,pkt and family war
i need some help to set a time for legwar,pkt and family war.. where can i set it??
13 Replies - EO PServer Hosting
Rsro event 16.06.2010 20 moscow time
So... show me the drops u guys got... post some pics
6 Replies - SRO Foreign - Discussions / Questions



All times are GMT +2. The time now is 19:07.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy
Copyright ©2017 elitepvpers All Rights Reserved.