official quest ?
string.format()
when exit.server_timer begin
d.exit_all()
server_timer("sd3_set_free",60*60)
end
when exit.server_timer begin
if (d.select(get_server_timer_arg())>0) then
d.exit_all()
server_timer("sd3_set_free",60*60)
end
end
Muss mich kurz halten, Bus fährt gleich:Quote:
Schaut nice aus ;)
Gibt ein gefällt mir!
Ich mag es nicht so diese Funktion zu benutzen:
Stellt die sicher, dass die Übergabe gecastet wird in den jeweilig verlangten Datentyp?PHP Code:string.format()
Ansonsten sehe ich keinen Sinn darin :)
haha geil ^^ Bus fährt gleich aber noch sowas schreiben ^^Quote:
Muss mich kurz halten, Bus fährt gleich:
string.format hilft einem, lange Strings leichter zusammenzusetzen. Gibt es in C++ auch als printf, sprintf etc.
mit %q zB kannst du ganz easy den qc-Bug, dass er ' zu " macht, umgehen (dort muss man dann sowas machen: "abc \\'123\\'"). Simpel gesagt: Get rid of \\ xD
-> string.format("abc %q","123") => abc "123"
Hach, die Quest ist so alt - damals kannte ich sowas noch garnicht :DQuote:
Kleine Anmerkung:
Vergiss nicht, per d.select auch das richtige Dungeon auszuwählen..Code:when exit.server_timer begin d.exit_all() server_timer("sd3_set_free",60*60) end
a) Testest damit, ob das Dungeon existiert
b) Gehst du damit sicher, dass du das richtige dungeon Ansprichst
Sonst kann es Syserr Fehler geben
sth like
Code:when exit.server_timer begin if (d.select(get_server_timer_arg())>0) then d.exit_all() server_timer("sd3_set_free",60*60) end end
SYSERR: Jun 7 19:05:57 :: Process: FDWATCH: peer null in event: ident 29 SYSERR: Jun 7 19:06:12 :: hupsig: SIGHUP, SIGINT, SIGTERM signal has been received. shutting down. SYSERR: Jun 7 19:06:12 :: ChildLoop: AsyncSQL: query failed: Query execution was interrupted (query: UPDATE player SET job = 2, voice = 0, dir = 0, x = 89600, y = 590500, z = 0, map_index = 1910000, exit_x = 69048, exit_y = 611791, exit_map_index = 191, hp = 9500, mp = 1538, stamina = 1250, random_hp = 2600, random_sp = 1238, playtime = 658, level = 66, level_step = 0, st = 90, ht = 90, dx = 26, iq = 5, gold = 927056607, exp = 389020, stat_point = 0, skill_point = 59, sub_skill_point = 57, stat_reset_count = 0, ip = '25.46.0.104', part_main = 11689, part_hair = 0, last_play = NOW(), skill_group = 1, alignment = 282886, horse_level = 21, horse_riding = 0, horse_hp = 34, horse_hp_droptime = 1402253602, horse_stamina = 120, horse_skill_point = 0, skill_level = '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ SYSERR: Jun 7 19:06:12 :: ChildLoop: AsyncSQL: query failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (query: UPDATE player SET job = 0, voice = 0, dir = 0, x = 89600, y = 590500, z = 0, map_index = 1910000, exit_x = 69018, exit_y = 610767, exit_map_index = 191, hp = 9511, mp = 1434, stamina = 1250, random_hp = 2661, random_sp = 1174, playtime = 771, level = 66, level_step = 1, st = 90, ht = 90, dx = 29, iq = 3, gold = 289572069, exp = 542880, stat_point = 0, skill_point = 65, sub_skill_point = 57, stat_reset_count = 0, ip = '25.46.0.104', part_main = 11289, part_hair = 0, last_play = NOW(), skill_group = 1, alignment = 292259, horse_level = 0, horse_riding = 0, horse_hp = 0, horse_hp_droptime = 0, horse_stamina = 0, horse_skill_point = 0, skill_level = '\0\0\0\0\0\0(\0\0\0\0(\0\0\0\0(\0\0\0\0(\0\0\0\0(\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ SYSERR: Jun 7 19:06:12 :: ChildLoop: AsyncSQL: retrying SYSERR: Jun 7 19:06:12 :: ChildLoop: AsyncSQL: query failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (query: UPDATE player SET job = 0, voice = 0, dir = 0, x = 89600, y = 590500, z = 0, map_index = 1910000, exit_x = 69018, exit_y = 610767, exit_map_index = 191, hp = 9511, mp = 1434, stamina = 1250, random_hp = 2661, random_sp = 1174, playtime = 771, level = 66, level_step = 1, st = 90, ht = 90, dx = 29, iq = 3, gold = 289572069, exp = 542880, stat_point = 0, skill_point = 65, sub_skill_point = 57, stat_reset_count = 0, ip = '25.46.0.104', part_main = 11289, part_hair = 0, last_play = NOW(), skill_group = 1, alignment = 292259, horse_level = 0, horse_riding = 0, horse_hp = 0, horse_hp_droptime = 0, horse_stamina = 0, horse_skill_point = 0, skill_level = '\0\0\0\0\0\0(\0\0\0\0(\0\0\0\0(\0\0\0\0(\0\0\0\0(\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ SYSERR: Jun 7 19:06:12 :: ChildLoop: AsyncSQL: retrying SYSERR: Jun 7 19:06:12 :: ChildLoop: AsyncSQL: query failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (query: UPDATE player SET job = 0, voice = 0, dir = 0, x = 89600, y = 590500, z = 0, map_index = 1910000, exit_x = 69018, exit_y = 610767, exit_map_index = 191, hp = 9511, mp = 1434, stamina = 1250, random_hp = 2661, random_sp = 1174, playtime = 771, level = 66, level_step = 1, st = 90, ht = 90, dx = 29, iq = 3, gold = 289572069, exp = 542880, stat_point = 0, skill_point = 65, sub_skill_point = 57, stat_reset_count = 0, ip = '25.46.0.104', part_main = 11289, part_hair = 0, last_play = NOW(), skill_group = 1, alignment = 292259, horse_level = 0, horse_riding = 0, horse_hp = 0, horse_hp_droptime = 0, horse_stamina = 0, horse_skill_point = 0, skill_level = '\0\0\0\0\0\0(\0\0\0\0(\0\0\0\0(\0\0\0\0(\0\0\0\0(\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ SYSERR: Jun 7 19:06:12 :: ChildLoop: AsyncSQL: retrying SYSERR: Jun 7 19:06:12 :: ChildLoop: AsyncSQL: query failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (query: UPDATE player SET job = 0, voice = 0, dir = 0, x = 89600, y = 590500, z = 0, map_index = 1910000, exit_x = 69018, exit_y = 610767, exit_map_index = 191, hp = 9511, mp = 1434, stamina = 1250, random_hp = 2661, random_sp = 1174, playtime = 771, level = 66, level_step = 1, st = 90, ht = 90, dx = 29, iq = 3, gold = 289572069, exp = 542880, stat_point = 0, skill_point = 65, sub_skill_point = 57, stat_reset_count = 0, ip = '25.46.0.104', part_main = 11289, part_hair = 0, last_play = NOW(), skill_group = 1, alignment = 292259, horse_level = 0, horse_riding = 0, horse_hp = 0, horse_hp_droptime = 0, horse_stamina = 0, horse_skill_point = 0, skill_level = '\0\0\0\0\0\0(\0\0\0\0(\0\0\0\0(\0\0\0\0(\0\0\0\0(\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ SYSERR: Jun 7 19:06:12 :: ChildLoop: AsyncSQL: retrying SYSERR: Jun 7 19:06:12 :: ChildLoop: AsyncSQL: query failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (query: UPDATE player SET job = 0, voice = 0, dir = 0, x = 89600, y = 590500, z = 0, map_index = 1910000, exit_x = 69018, exit_y = 610767, exit_map_index = 191, hp = 9511, mp = 1434, stamina = 1250, random_hp = 2661, random_sp = 1174, playtime = 771, level = 66, level_step = 1, st = 90, ht = 90, dx = 29, iq = 3, gold = 289572069, exp = 542880, stat_point = 0, skill_point = 65, sub_skill_point = 57, stat_reset_count = 0, ip = '25.46.0.104', part_main = 11289, part_hair = 0, last_play = NOW(), skill_group = 1, alignment = 292259, horse_level = 0, horse_riding = 0, horse_hp = 0, horse_hp_droptime = 0, horse_stamina = 0, horse_skill_point = 0, skill_level = '\0\0\0\0\0\0(\0\0\0\0(\0\0\0\0(\0\0\0\0(\0\0\0\0(\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ SYSERR: Jun 7 19:06:12 :: ChildLoop: AsyncSQL: retrying SYSERR: Jun 7 19:06:12 :: ChildLoop: AsyncSQL: query failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (query: UPDATE player SET job = 0, voice = 0, dir = 0, x = 89600, y = 590500, z = 0, map_index = 1910000, exit_x = 69018, exit_y = 610767, exit_map_index = 191, hp = 9511, mp = 1434, stamina = 1250, random_hp = 2661, random_sp = 1174, playtime = 771, level = 66, level_step = 1, st = 90, ht = 90, dx = 29, iq = 3, gold = 289572069, exp = 542880, stat_point = 0, skill_point = 65, sub_skill_point = 57, stat_reset_count = 0, ip = '25.46.0.104', part_main = 11289, part_hair = 0, last_play = NOW(), skill_group = 1, alignment = 292259, horse_level = 0, horse_riding = 0, horse_hp = 0, horse_hp_droptime = 0, horse_stamina = 0, horse_skill_point = 0, skill_level = '\0\0\0\0\0\0(\0\0\0\0(\0\0\0\0(\0\0\0\0(\0\0\0\0(\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ SYSERR: Jun 7 19:06:12 :: ChildLoop: AsyncSQL: retrying SYSERR: Jun 7 19:06:12 :: ChildLoop: AsyncSQL: query failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (query: UPDATE player SET job = 0, voice = 0, dir = 0, x = 89600, y = 590500, z = 0, map_index = 1910000, exit_x = 69018, exit_y = 610767, exit_map_index = 191, hp = 9511, mp = 1434, stamina = 1250, random_hp = 2661, random_sp = 1174, playtime = 771, level = 66, level_step = 1, st = 90, ht = 90, dx = 29, iq = 3, gold = 289572069, exp = 542880, stat_point = 0, skill_point = 65, sub_skill_point = 57, stat_reset_count = 0, ip = '25.46.0.104', part_main = 11289, part_hair = 0, last_play = NOW(), skill_group = 1, alignment = 292259, horse_level = 0, horse_riding = 0, horse_hp = 0, horse_hp_droptime = 0, horse_stamina = 0, horse_skill_point = 0, skill_level = '\0\0\0\0\0\0(\0\0\0\0(\0\0\0\0(\0\0\0\0(\0\0\0\0(\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ SYSERR: Jun 7 19:06:12 :: ChildLoop: AsyncSQL: retrying
quest spider_access begin
state start begin
when 30130.chat."Das Nest der Spinnenbaronin" begin
say_title(mob_name(30130))
say("")
say("Ok, wie ich sehe bist du bereit das Nest der Baronin zu betretten")
say("aber du musst im klaren sein das du in einer Gruppe sein musst")
say("und der Anführer der Gruppe muss einen Arachniden-Schlüssel besitzen")
say("der Anführer muss mich ansprechen !")
say("")
local go = select ("Ich bin bereit." , "Später vllt.")
if go == 1 then
if game.get_event_flag("spider_lair_ongoing_"..pc.get_channel_id()) == 1 then
say_title(mob_name(30130))
say("")
say("Der Spinnenbaron wacht auf..")
say("Spinnenbaron: WER WAGT ES MICH ZU STÖREN !!")
say("")
wait()
local starttime = game.get_event_flag("spider_lair_start_time_"..pc.get_channel_id())
local current_time = get_global_time()
--1.1ÇØ´ç ÆÄƼ¿¡ ¼ÓÇØÀÖ´Ù.
if party.get_leader_pid() == game.get_event_flag("spider_lair_leader_"..pc.get_channel_id()) then
if starttime + 300 >= current_time and party.get_leader_pid() == game.get_event_flag("spider_lair_leader_"..get_channel_id()) and game.get_event_flag("spider_lair_ongoing_"..get_channel_id()) == 1 then
say_title(mob_name(30130))
say("")
say("Die Zeit ist gekommen ich hoffe ihr seid in der lage")
say("den Baron zu töten.")
say("")
say_reward("Töte den Baron mit deiner Gruppe")
say("")
pc.warp(88100,614700)
pc.setqf("firstIn",1)
pc.setqf("retry_limit_time", starttime + 1200 + 3600)
return
else
say_title(mob_name(30130))
say("")
say("Du kannst den Dungeon gerade nicht betretten.. Bitte Warten")
return
end
else
say_title(mob_name(30130))
say("")
say("Du kannst das Nest nicht betretten, warte: "..pc.getqf("spider_lair_end_time_")..pc.get_channel_id() - get_global_time().."minuten.")
say("")
return
end
--2. ÀçµµÀü Á¦ÇÑ ½Ã°£¿¡ °É¸®³ª?
elseif pc.getqf("retry_limit_time") > get_global_time() then
say("Du kannst das Nest nicht betretten, warte : "..pc.getqf("retry_limit_time") - get_global_time())
return
--3. ¸®´õ´Ù.
elseif party.is_leader() then
say_title(mob_name(30130))
say("")
say("Ich seh es in dein Augen du bist bereit das Nest zu betretten.")
say("Ich bring dich dorthin")
say("und die leute aus deiner Gruppe müssen dir folgen")
say("")
if pc.count_item(30324) > 0 then
say("Ich sehe du hast den Arachnidenschlüssel")
say("willst du das Nest des Spinnenbaron betretten ?")
say("")
local warp = select("Ja","Nein..")
if warp == 1 then
pc.warp(88100,614700)
pc.remove_item(30324, 1)
mob.spawn(2094,369,551,0,0)
--°ª ¼³Á¤.
game.set_event_flag("spider_lair_ongoing_"..pc.get_channel_id(), 1)
game.set_event_flag("spider_lair_start_time_"..pc.get_channel_id(), get_global_time())
game.set_event_flag("spider_lair_end_time_"..pc.get_channel_id(), get_global_time()+1200)
game.set_event_flag("spider_lair_leader_"..pc.get_channel_id(), party.get_leader_pid())
pc.setqf("retry_limit_time", get_global_time() + 1200 + 3600 )
pc.setqf("firstIn",1)
server_timer("spider_end_timer", 1800)
end
return
else
say("")
say("Du brauchst ein Arachnidenschlüssel um das Nest zu betretten.")
say_item_vnum(30324)
say("")
return
end
else --¸®´õ ¾Æ´Ï´Ù.
say_title(mob_name(20011))
say("")
say("Sieht so aus als währst du in keiner Gruppe")
say("oder dein Gruppenanführer ist noch nicht im Nest")
say("")
return
end
end
end
when spider_end_timer.server_timer begin
warp_all_in_area_to_area(82700, 612700, 93700,625700, 69100, 614800, 69100, 614800)
game.set_event_flag("spider_lair_ongoing_"..get_channel_id(),0)
game.set_event_flag("spider_lair_leader_"..get_channel_id(), 0)
game.set_event_flag("spider_dead"..get_channel_id(),0)
purge_area(82700, 612700, 93700,625700)
end
when login begin
if pc.getqf("firstIn") == 1 and party.get_leader_pid() == game.get_event_flag("spider_lair_leader_"..get_channel_id()) then
pc.setqf("firstIn",0)
elseif pc.getx() >= 827 and pc.getx() <= 937 and pc.gety() >= 6127 and pc.gety() <= 6257 then
pc.warp(95900,571000)
pc.remove_item(30327, 1)
else
pc.remove_item(30327, 1)
local limit = pc.getqf("retry_limit_time")
local access_limit_time = 3600
if limit > ( get_global_time() + access_limit_time ) then
limit = ( get_global_time() + access_limit_time )
end
pc.setqf("retry_limit_time", limit )
local duration = limit - get_global_time()
end
end
end
end
function allincl() -- Einstellungen für den Dungeon
return
{
['ENTRY_pos'] = {8854, 9742},
['LEAVE_pos'] = {9597, 2729},
['DUNGEON_NPC_pos'] = {61, 48},
['FIRST_STONE_pos'] = {
{104, 62},
{161, 52},
{206, 79},
{181, 135},
{112, 145},
},
['SECOND_STONE_pos'] = {181, 195},
}
end
Bei älteren Files gehen defines nicht.Quote:
Um deine Quest's übersichtlicher zu gestalten würde ich dir auch raten mit Defines zu arbeiten, bzw speziell bei einer dungeonquest, questinterne Funktionen zu benutzen. :)
damit hättest du zum Beispiel die ganzen Koordinaten die deine Quest benutzt, schön geordnet in einer Funktion. Ein weiteres Beispiel wäre auch noch eine Servertimerclearfunktion, die bei allen möglichen Abbrüchen / Fehlern des Dungeons ausgeführt wird :)PHP Code:function allincl() -- Einstellungen für den Dungeon
return
{
['ENTRY_pos'] = {8854, 9742},
['LEAVE_pos'] = {9597, 2729},
['DUNGEON_NPC_pos'] = {61, 48},
['FIRST_STONE_pos'] = {
{104, 62},
{161, 52},
{206, 79},
{181, 135},
{112, 145},
},
['SECOND_STONE_pos'] = {181, 195},
}
end
liebe Grüße,
dein callmaxilein