ionutxp 72 Posted July 10, 2014 Share Posted July 10, 2014 Hey, Today I was working to extend the qc features. I managed to add: - Lua defines - When clause functions Example: define DOG ""Anne has apples."" define NAB "red" define TESTX 323 define PI 3.14 define EXPR "if x == 10 then say(22) end" define _TRA_ "translate" quest test begin state start begin function doStuff(x, y) say(DOG); end function doStuffAgain(www) say("Test") say(22) end when 20088.chat.translate."SD2.ENTER" begin say(DOG) doStuff(TESTX, 12) end when TESTX.chat."Testx" begin EXPR; say("Random text ! "); end end end Now, you can translate your quest select fields with ease: quest test begin state start begin when 2222.chat.tra."ENTER.TITLE" begin say(DOG) end end end Make sure to have a: function tra(str_key) return global_table[get_language()][str_key]; end when 2222.chat.x.y.z.tra.d."ENTER.TITLE" begin will convert to: when x(y(z(tra(d("ENTER.TITLE))))) I'll come back with the source code after some tests and, a new description and new examples. Download: http://ionutmilica.ro/downloads/revs/qc_last.rar Source code: This is the hidden content, please Sign In or Sign Up 10 1 1 1 17 Link to comment Share on other sites More sharing options...
callmax 229 Posted July 13, 2014 Share Posted July 13, 2014 could you upload the src or compile a windows executable? Link to comment Share on other sites More sharing options...
ionutxp 72 Posted July 13, 2014 Author Share Posted July 13, 2014 Source code: This is the hidden content, please Sign In or Sign Up As you can see, i hold a quest folder (project) in the same path as libsql / liblua. Edit it accordingly. 2 1 1 6 Link to comment Share on other sites More sharing options...
ionutxp 72 Posted July 15, 2014 Author Share Posted July 15, 2014 Update: Fixed major bugs and translate function. Now, you can override default tra function name in when-event translation. define _TRA_ "translate" and when 20088.chat.translate."SD2.ENTER" begin 2 Link to comment Share on other sites More sharing options...
Yiv 321 Posted July 17, 2014 Share Posted July 17, 2014 (edited) Even if I already had an enhancement in my compiler like your translate thing I used your because I didn't have the define thing (don't want to use the pre_qc.py always). Could it be that the compiler has a problem with functions now? locale/germany/quest/object/state/oxevents oxevents={["start"]=0,open= function ()oxevent open oxevent open ,quiz= function ()oxevent quiz oxevent quiz ,check= function ()gmlist i table getn gmlist gmlist i pc name } oxevent.quest quest oxevents begin state start begin function open() if(oxevent.open() == 0) then return 0 elseif(oxevent.open() == 1) then return 1 else return 2 end end function quiz() if(oxevent.quiz(1,30) == 0) then return 0 elseif(oxevent.quiz(1,30) == 1) then return 1 else return 2 end end function check() local gmlist = {"[NA]Raysis"} for i = 1,table.getn(gmlist),1 do if(gmlist[i] == pc.name) then return true else return false end end end when 20011.chat."Der OX-Wettbewerb" with pc.is_gm() and oxevents.check() == true and game.get_event_flag("automatic_oxevent_status") == 0 begin say_title(mob_name(npc.get_race())..":") say("") say("Möchtest du den Wettbewerb starten? ") say("") local s = select(locale.yes,locale.no) if(s == 2) then return end say_title(mob_name(npc.get_race())..":") say("") say_reward("Info: Uhrzeit: "..os.date("%H")) say("") say("Um wie viel Uhr soll der Wettbewerb starten? ") local times = tonumber(input() ) if(times == "" or tonumber(times) == nil) then return end say_title(mob_name(npc.get_race())..":") say("") game.set_event_flag("automatic_oxevent_opentime",times) say("Der Wettbewerb wurde gestartet!") say("Wird in "..times.." Stunden geöffnet! ") game.set_event_flag("automatic_oxevent_status",1) server_timer('check',30) end when check.server_timer begin if(os.date("%H") == game.get_event_flag("automatic_oxevent_opentime")) then if(oxevents.open() == 0) then print("Der Wettbewerb wurde bereits Gestartet!") elseif(oxevents.open() == 1) then notice_all("~~~~~~~~~~~ OX-EVENT ~~~~~~~~~~~") notice_all("Das OX-Event beginnt in wenigen Minuten.") notice_all("Um daran teilzunehmen, sprecht mit Uriel.") notice_all("~~~~~~~~~~~ OX-EVENT ~~~~~~~~~~~") server_timer('countdownone',60) else print("Es ist ein Fehler aufgetreten!") end else server_timer('checktwo',30) end end when checktwo.server_timer begin if(os.date("%H") == game.get_event_flag("automatic_oxevent_opentime")) then if(oxevents.open() == 0) then print("Der Wettbewerb wurde bereits Gestartet!") elseif(oxevents.open() == 1) then notice_all("~~~~~~~~~~~ OX-EVENT ~~~~~~~~~~~") notice_all("Das OX-Event beginnt in wenigen Minuten.") notice_all("Um daran teilzunehmen, sprecht mit Uriel.") notice_all("~~~~~~~~~~~ OX-EVENT ~~~~~~~~~~~") server_timer('countdownone',60) else print("Es ist ein Fehler aufgetreten!") end else server_timer('check',30) end end when countdownone.server_timer begin notice_all("<OX> Ihr habt noch 4 Minuten Zeit, um am OX-Event teilzunehmen.") server_timer("countdowntwo",60) end when countdowntwo.server_timer begin notice_all("<OX> Ihr habt noch 3 Minuten Zeit, um am OX-Event teilzunehmen.") server_timer("countdownthree",60) end when countdownthree.server_timer begin notice_all("<OX> Ihr habt noch 2 Minuten Zeit, um am OX-Event teilzunehmen.") server_timer("countdownfour",60) end when countdownfour.server_timer begin notice_all("<OX> Ihr habt noch 1 Minuten Zeit, um am OX-Event teilzunehmen.") server_timer("countdownfive",30) end when countdownfive.server_timer begin notice_all("<OX> Die Teilnahme am OX-Event wird in 30 Sekunden geschlossen.") server_timer("countdown",30) end when countdown.server_timer begin notice_all("<OX> Die Teilnahmemöglichkeit am OX-Event wurde geschlossen.") notice_all("<OX> Es können nur noch Zuschauer beitreten.") game.set_event_flag("automatic_oxevent_status",2) server_timer('playercheck',10) game.set_event_flag("automatic_oxevent_opentime",0) end when playercheck.server_timer begin if(pc.get_map_index() == 113) then if(oxevent.get_attender() == 0) then notice_all("<OX> Das OX-Event wurde beendet, da es keine Teilnehmer gab.") game.set_event_flag("automatic_oxevent_status",0) game.set_event_flag("automatic_oxevent_opentime",0) else return end else server_timer("oxeventstart",10) end end when oxeventstart.server_timer begin if(pc.get_map_index() == 113) then if(oxevents.quiz() == 0) then print("Der Wettbewerb wurde beendet!") elseif(oxevents.quiz() == 1) then notice_in_map("Frage wurde gestellt...") server_timer("goon",30) else print("Seit ihr bereit für die nächste Frage?") end else return end end when goon.server_timer begin -- Check if(oxevent.get_attender() == 0) then notice_in_map("Das Event wird beendet, da es keine Teilnehmer mehr gibt.") game.set_event_flag("automatic_oxevent_status",0) game.set_event_flag("automatic_oxevent_opentime",0) warp_all_to_village() elseif(oxevent.get_attender() == 1) then notice_in_map("Das Event ist vorbei. Der Gewinner erhält sein Item.") oxevent.give_item(20, 1) game.set_event_flag("automatic_oxevent_status",0) game.set_event_flag("automatic_oxevent_opentime",0) server_timer("over",20) else server_timer("goontwo",30) end end when over.server_timer begin warp_all_to_village() end when goontwo.server_timer begin if(oxevent.get_attender() == 0) then notice_in_map("Das Event wird beendet, da es keine Teilnehmer mehr gibt.") game.set_event_flag("automatic_oxevent_status",0) game.set_event_flag("automatic_oxevent_opentime",0) warp_all_to_village() elseif(oxevent.get_attender() == 1) then notice_in_map("Das Event ist vorbei. Der Gewinner erhält sein Item.") oxevent.give_item(20, 1) game.set_event_flag("automatic_oxevent_status",0) game.set_event_flag("automatic_oxevent_opentime",0) server_timer("over",20) else server_timer("goon",30) end end when 20011.chat."Der OX-Wettbewerb" begin addimage(25, 25, "oxevent.tga") say("[ENTER][ENTER][ENTER][ENTER][ENTER]") say_npc_title() say("") if(game.get_event_flag("automatic_oxevent_status") == 2) then say("Das Event läuft bereits. Du kannst nurnoch als[ENTER]Zuschauer beitreten.") say_reward("Möchtest du als Zuschauer beitreten?") local s = select(locale.yes,locale.no) if(s == 2) then return end pc.warp(896300, 28900) elseif(game.get_event_flag("automatic_oxevent_status") == 1) then say("Du kannst am OX-Event teilnehmen.[ENTER]Möchtest du teilnehmen?") local s = select(locale.yes,locale.no,"Als Zuschauer") if(s == 1) then pc.warp(896500, 24600) elseif(s == 3) then pc.warp(896300, 28900) end else say("Das Event findet derzeit nicht statt.") say("") return end end end end You can help? Regards Edited August 17, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
ionutxp 72 Posted July 18, 2014 Author Share Posted July 18, 2014 You've compiled from the source the QC ? I will take a look today Thank you for the report ! Link to comment Share on other sites More sharing options...
Yiv 321 Posted July 18, 2014 Share Posted July 18, 2014 I compiled the qc project of mainline, so yeah. Regards Link to comment Share on other sites More sharing options...
Zardon 4 Posted July 20, 2014 Share Posted July 20, 2014 I have the sam problem like DaJuBi Link to comment Share on other sites More sharing options...
ionutxp 72 Posted July 20, 2014 Author Share Posted July 20, 2014 Strage as I've already solved that bug. I've reuploaded the binary. Link to comment Share on other sites More sharing options...
Yiv 321 Posted July 20, 2014 Share Posted July 20, 2014 Thank you. Would you please be so kind to upload the source, too? Because I want to add some things on my own, too. Regards Link to comment Share on other sites More sharing options...
ionutxp 72 Posted July 20, 2014 Author Share Posted July 20, 2014 The link is in the first post Link to comment Share on other sites More sharing options...
quentin869 4 Posted July 21, 2014 Share Posted July 21, 2014 (edited) Hi, (sorry for my bad english) I have a problem, i try to make a quest in windows environment, also i start the debug of qc in my vs 2008 and i add a loop in my main for read the locale_list like that : string line; ifstream myfile ("locale_list"); if (myfile.is_open()) { while ( getline (myfile,line) ) { char* t = strdup(line.c_str()); g_filename = t; /* I break here */ parse(g_filename); /* here */ free(t); } myfile.close(); } i add a break point access condition fixed at 27 hit AND every time qc crash at this line (in parse method) : void parse(char * filename) { ifstream inf(filename); LoadF lf; lf.f = fopen(filename, "r"); ZIO z; luaZ_init(&z, getF, &lf, "quest"); Mbuffer b; struct LexState lexstate; pls = &lexstate; luaZ_initbuffer(L, &; lexstate.buff = &b; luaX_setinput(L, &lexstate, &z, luaS_new(L, zname(&z))); /* here */ ... My error : If i continue to debug, i go to feoferr.c at this line : int __cdecl feof ( FILE *stream ) { _VALIDATE_RETURN((stream != NULL),EINVAL, 0); /* here */ return( ((stream)->_flag & _IOEOF) ); } ----- Edit ----- I have found a solution but i don't think it is a good solution : void parse(char * filename) { ifstream inf(filename); LoadF lf; lf.f = fopen(filename, "r"); if(!lf.f) // Check feof here return; ZIO z; luaZ_init(&z, getF, &lf, "quest"); Mbuffer b; struct LexState lexstate; pls = &lexstate; luaZ_initbuffer(L, &; lexstate.buff = &b; luaX_setinput(L, &lexstate, &z, luaS_new(L, zname(&z))); Your opinion ? Best regards, Quentin. Edited August 17, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
ionutxp 72 Posted July 21, 2014 Author Share Posted July 21, 2014 I think it's better to simply use a shell script for this kind of job. For example ./qc is used to compile a single or more files from cmd line not from a specific file. Like in the standard server files, use a python file that calls qc for each quest found in the list... Link to comment Share on other sites More sharing options...
quentin869 4 Posted July 21, 2014 Share Posted July 21, 2014 Okay thank for your reply it's just for debug in vs , but for the feof what do you think of my solution ? Link to comment Share on other sites More sharing options...
ionutxp 72 Posted July 21, 2014 Author Share Posted July 21, 2014 Yes I, also pached the source from git. Link to comment Share on other sites More sharing options...
Night 367 Posted July 21, 2014 Share Posted July 21, 2014 i think this is better then using per qc.py thanks waiting for more updates Link to comment Share on other sites More sharing options...
.Xero 2 Posted April 18, 2015 Share Posted April 18, 2015 please reupload the source Link to comment Share on other sites More sharing options...
Sydai 2 Posted June 29, 2015 Share Posted June 29, 2015 Invalid links... Link to comment Share on other sites More sharing options...
.NyanCat 24 Posted February 26, 2020 Share Posted February 26, 2020 Can anyone reupload this code please? Link to comment Share on other sites More sharing options...
topolino1958 17 Posted August 23, 2020 Share Posted August 23, 2020 Can anyone reupload this code please? Link to comment Share on other sites More sharing options...
Management AZICKO 7435 Posted October 11, 2020 Management Share Posted October 11, 2020 (edited) Dead Download Link Moved Topic If someone has the archive of this topic, can you send it to us? Thank you! Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal 1 Scamming ? Reselling ? metin2.download | metin2.dev | fr.metin2.dev | metin2dev.org | metin2.top | top-metin2.org Link to comment Share on other sites More sharing options...
Premium CHXMVN 436 Posted March 12, 2022 Premium Share Posted March 12, 2022 I also need the source, a reupload would be great Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now