Register for your free account! | Forgot your password?
Rust Cheats

You last visited: Today at 02:23

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

Advertisement



[Release] Lua Questcompiling Script

Discussion on [Release] Lua Questcompiling Script within the Metin2 PServer Guides & Strategies forum part of the Metin2 Private Server category.

Reply
 
Old   #1

 
elite*gold: 83
Join Date: Nov 2013
Posts: 2,891
Received Thanks: 2,764
[Release] Lua Questcompiling Script

Benötigt: Lua Installation
Getestet mit: Lua 5.0
Befehl zum Ausführen: cd /usr/.../quest && lua compile_quests.lua

Screens

Ich habe mal ein kleines Lua-Script geschrieben, um den questcompiler anzusprechen. Verwaltet wird das ganze über die Datei quest_list.lua, welche die Pfade zu den Quests beinhaltet.
Wenn ihr Keys setzt, wie im Beispiel zu sehen, könnt ihr auch einzelne Kategorien compilen, z.B. alle Quests in der Kategorie Biologe.

Beispiel quest_list.lua:
Code:
quest_list = {
	["Biologe"] = {
		["Biologe1"] = "biologe1.quest",
		["Biologe2"] = {
			"biologe2_1.quest",
			"biologe2_2.quest"
		},
		"biologe.quest"
	},
	["Dt"] = "deviltowerzone.quest"
}
beachtet hierbei, dass die Keys (z.B. "Biologe", "Biologe1") nichts mit der Ordnerstruktur zu tun haben müssen!

Das Script (compile_quests.lua)
Code:
local qcname = "qc_x64"
local luaquest_list = "quest_list.lua"


--[[
	#########################
	####### Functions #######
	#########################
]]

local println = function(text)
	io.write(text.."\n")
end

local function file_exists(name)
	return os.rename(name, name)
end

-- ##################################################
-- Check if required files exist
if not file_exists(qcname) then
	println("Can't find the qc: "..qcname)
	io.flush()
	return
elseif not file_exists(luaquest_list) then
	println("Can't find the quest_list: "..luaquest_list)
	io.flush()
	return
end
-- Chekc if required files exist end
-- ##################################################

local function in_list(compare, list)
	for _,v in ipairs(list) do
		if compare == v then return true end
	end
	return false
end

local function compile(dir)
	println("Compiling: "..dir)
	os.execute("./"..qcname.." "..dir)
end

local function compile_tbl(value)
	if type(value) == "string" then
		compile(value)
		return
	end
	for k,v in pairs(value) do
		if type(v) == "table" then
			compile_tbl(v)
		else
			compile(v)
		end
	end
end

local function compile_all()
	os.execute("rm -R object")
	compile_tbl(quest_list)
end

--[[
	#####################
	####### Menus #######
	#####################
]]

local function compile_by_directory_menu()
	println("")
	println("What's the directory of the quest you want to compile?")
	io.flush()
	local dir = io.read()
	if not file_exists(dir) then
		local answer = ""
		local possible_answers = {"1", "exit"}
		repeat
			println("")
			println("The directory doesnt exist: "..dir)
			println("	("..possible_answers[1]..") new directory")
			println("	("..possible_answers[2]..") exit")
			io.flush()
			answer = io.read()
		until in_list(answer, possible_answers)
		
		if answer == possible_answers[1] then --new directory
			compile_by_directory_menu()
			return
		else
			return
		end
	end
	compile(dir)
end

local function compile_by_category_menu(srctable)
	println("")
	println("What's key to the quest(s) you want to compile?")
	io.flush()
	local key = io.read()
	local result = srctable[key]
	if not result then
		local answer = ""
		local possible_answers = {"1", "exit"}
		repeat
			println("")
			println("Can't find a value matching to the key: "..key)
			println("	("..possible_answers[1]..") new key")
			println("	("..possible_answers[2]..") exit")
			io.flush()
			answer = io.read()
		until in_list(answer, possible_answers)
		
		if answer == possible_answers[1] then --new key
			compile_by_category_menu(srctable)
			return
		else
			return
		end
	elseif type(result) == "table" then
		local answer = ""
		local possible_answers = {"1", "2", "exit"}
		repeat
			println("")
			println("The value matching to your key is a table")
			println("	("..possible_answers[1]..") compile all quests in this category and it's subcategories")
			println("	("..possible_answers[2]..") go deeper (insert subcategory)")
			println("	("..possible_answers[3]..") exit")
			io.flush()
			answer = io.read()
		until in_list(answer, possible_answers)
		
		if answer == possible_answers[1] then --compile all quests in this category
			compile_tbl(result)
			return
		elseif answer == possible_answers[2] then --go deeper
			compile_by_category_menu(result)
			return
		else
			return
		end
	end
	compile_tbl(result)
end

local function main_menu()
	local answer = ""
	local possible_answers = {"1", "2", "3", "exit"}
	repeat
		println("What do you want to do?")
		println("	("..possible_answers[1]..") Compile all quests")
		println("	("..possible_answers[2]..") Compile quest(s) by key")
		println("	("..possible_answers[3]..") Compile quest by directory")
		println("	("..possible_answers[4]..") exit")
		io.flush()
		answer = io.read()
	until in_list(answer, possible_answers)
	
	if answer == possible_answers[1] then --compile all quests
		compile_all()
	elseif answer == possible_answers[2] then --compile all quests by category
		compile_by_category_menu(quest_list)
	elseif answer == possible_answers[3] then --compile quest by directory
		compile_by_directory_menu()
	else
		return
	end
end

--[[
	############################
	####### Calling menu #######
	############################
]]

dofile(luaquest_list)
main_menu()
rollback is offline  
Thanks
15 Users
Old 07/25/2015, 16:08   #2
 
Yiv's Avatar
 
elite*gold: 47
Join Date: Feb 2012
Posts: 2,282
Received Thanks: 2,579
Wie gesagt, du hast viel zu viel Zeit.
Dennoch danke dafür

MfG
Yiv is offline  
Thanks
1 User
Old 07/25/2015, 16:14   #3
 
elite*gold: 0
Join Date: Jun 2011
Posts: 128
Received Thanks: 19
Ich muss ehrlich gesagt sagen, dass ich den Sinn daran nicht ganz verstehe :/
x3PrInZpIx3 is offline  
Old 07/25/2015, 16:19   #4

 
elite*gold: 83
Join Date: Nov 2013
Posts: 2,891
Received Thanks: 2,764
Quote:
Originally Posted by x3PrInZpIx3 View Post
Ich muss ehrlich gesagt sagen, dass ich den Sinn daran nicht ganz verstehe :/
Du kannst deine Quests in der quest_list in Kategorien unterteilen und diese Kategorien einzeln compilen.

Beispiel:
Du hast eine Änderung an einer Funktion gemacht, die nur Dungeons betrifft, und möchtest nicht alle Quests neu compilen sondern nur die Dungeons.
Dann machst du eine Kategorie mit "Dungeons" und schreibst dort alle Verweise zu Dungone-Quests rein und kannst mit dem Script alle Quests aus der Kategorie compilen lassen.
rollback is offline  
Old 07/25/2015, 16:36   #5
 
elite*gold: 2785
Join Date: Dec 2014
Posts: 403
Received Thanks: 1,354
Schicke Idee. Ich habe sowas ähnliches in Python aber da kann ich mir ja mal was abschauen da es mit den Kategorien sehr Interessant ist
.K0rí is offline  
Thanks
1 User
Old 07/25/2015, 17:09   #6
 
..ѕιяιυѕѕ¢нωєят's Avatar
 
elite*gold: 0
Join Date: Dec 2014
Posts: 33
Received Thanks: 22
Schick Schick
..ѕιяιυѕѕ¢нωєят is offline  
Thanks
1 User
Old 07/25/2015, 19:44   #7
 
SinSay's Avatar
 
elite*gold: 120
Join Date: May 2013
Posts: 419
Received Thanks: 208
Gute arbeit von dir danke!
SinSay is offline  
Thanks
1 User
Old 07/26/2015, 17:30   #8
 
deltous'fabius's Avatar
 
elite*gold: 84
Join Date: May 2013
Posts: 479
Received Thanks: 235
@Sensi schönes Release. Da ich mich mit Lua nicht grade auskenne, könntest du das Script auch ohne Menü zur verfügung stellen, dass einfach alle Quest einmal kompiliert werden?
deltous'fabius is offline  
Thanks
1 User
Old 07/26/2015, 17:32   #9

 
elite*gold: 83
Join Date: Nov 2013
Posts: 2,891
Received Thanks: 2,764
Quote:
Originally Posted by deltous'fabius View Post
@Sensi schönes Release. Da ich mich mit Lua nicht grade auskenne, könntest du das Script auch ohne Menü zur verfügung stellen, dass einfach alle Quest einmal kompiliert werden?
einfach ganz unten main_menu() durch compile_all() ersetzen
rollback is offline  
Old 07/26/2015, 18:38   #10



 
DerZynx's Avatar
 
elite*gold: 0
Join Date: Apr 2011
Posts: 1,121
Received Thanks: 271
Sieht nice aus. Danke, werd ich direkt mal benutzen ^^
DerZynx is offline  
Thanks
1 User
Old 07/29/2015, 01:28   #11
 
Deus 's Avatar
 
elite*gold: 1790
Join Date: Oct 2013
Posts: 3,769
Received Thanks: 7,443
Sehr schicke Sache, mach weiter so!
Deus  is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[Release][GC PH] Script and Char script
10/22/2009 - Grand Chase Hacks, Bots, Cheats & Exploits - 27 Replies
Here's the Script and Char_script with yellow lines hope it helped paki crch2 na lang po kasi na delete ko ung crch2 ko if any problems paki post na lang agad Credits to :handsdown::handsdown:Brian~ and Craymel:handsdown::handsdown: Btw... pang range po yan pede rin ung jump attack(Down) ng Dk,ragna bolt,block attack ng Ak,jump attack ng lass ung iba ko pang d nsabi paki banggit na rin



All times are GMT +1. The time now is 02:24.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.