Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Metin2 > Metin2 Private Server > Metin2 PServer Guides & Strategies
You last visited: Today at 05:11

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

Advertisement



[Release] LanguageSystem - How to divide the quests according to the language

Discussion on [Release] LanguageSystem - How to divide the quests according to the language within the Metin2 PServer Guides & Strategies forum part of the Metin2 Private Server category.

Reply
 
Old   #1
 
lollo_9_1's Avatar
 
elite*gold: 100
Join Date: Jun 2009
Posts: 168
Received Thanks: 711
Arrow [Release] LanguageSystem - How to divide the quests according to the language

Intro
There are no reasons why I posted this quest.
Maybe I saw more quest abortion that used lotofIF or, in recent cases, game.set_event_flag("language"..pc.get_name()) or mysql_query!
Things from another world.

How to compile
Create the file languagesystem.quest with this content:
Code:
quest languagesystem begin
	state start begin
		function GetMyLan()
			--check language
			local mylan=pc.getf("game_option", "language")
			if(mylan==0)then
				mylan=1--already local, not global!
			end
			return mylan
		end
		function GetMyString(lanid, strid)
			--lan-table (list-mode)
			local mystrings={
				{"Language panel", "No language selected","Which language do you prefer?","Back","Language successfully changed.","","","","","","",""},
				{"Pannello lingua", "Nessuna lingua selezionata","Quale lingua preferisci?","Indietro","Lingua correttamente cambiata.","","","","","","",""},
				{"deutschestring1","deutschestring2","","","","","","","","","",""},
				{"francaisstring1","francaisstring2","","","","","","","","","",""},
				{"espanolstring1","espanolstring2","","","","","","","","","",""},
				{"chinesestring1","chinesestring2","","","","","","","","","",""},
				{"japanesestring1","japanesestring2","","","","","","","","","",""},
			}
			return mystrings[lanid][strid]
		end
        when letter begin
            send_letter(languagesystem.GetMyString(languagesystem.GetMyLan(), 1))
        end
		
        when info or button begin
			local mylan=languagesystem.GetMyLan()
			local resend_letter=function(title) makequestbutton(title) q.set_title(title) q.start() end
			--select language
			say_title(languagesystem.GetMyString(mylan, 1))
			say(languagesystem.GetMyString(mylan, 3))
			local myarsel={"English", "Italiano", "Deutsche", "Francais", "AfroChinese"}
			table.insert(myarsel,languagesystem.GetMyString(mylan, 4))
			local mysel=select_table(myarsel)
			--process language
			if(mysel~=table.getn(myarsel))then --no back
				mylan=mysel--already local, not global!
				pc.setf("game_option", "language", mysel)
			end
			say_reward(languagesystem.GetMyString(mylan, 5))
			--letter remake
			resend_letter(languagesystem.GetMyString(mylan, 1))
		end
		
		
	end
end
Now, add the new quest's functions in the quest_functions file:
Code:
cd /path/to/quest
echo resend_letter >> quest_functions
echo languagesystem.GetMyLan >> quest_functions
echo languagesystem.GetMyString >> quest_functions
Now compile:
Code:
./qc languagesystem.quest
How to use this in a normal quest
It's simple. U can use it using questlib.lua/locale.lua
Otherwise, here's an example:
Code:
quest examplelan begin
	state start begin
		when login begin
			local mylan=languagesystem.GetMyLan()
			--lan-table (dict-mode)
			local myarr={
				{["mex1"]="Welcome!",["mex2"]="blablabla1"},
				{["mex1"]="Benvenuto!",["mex2"]="blablabla2"},
				{["mex1"]="Willkommen!",["mex2"]="blablabla3"},
				{["mex1"]="Bienvenue!",["mex2"]="blablabla4"},
				{["mex1"]="Huan Ying!",["mex2"]="blablabla5"},
				{["mex1"]="Youkoso!",["mex2"]="blablabla5"},
			}
			syschat(myarr[mylan].mex1)
			--mex2 here is unused, u can delete it from the table
		end
	end
end
Enjoy!
lollo_9_1 is offline  
Thanks
6 Users
Old 04/20/2013, 17:27   #2
 
.Rebel's Avatar
 
elite*gold: 60
Join Date: May 2010
Posts: 766
Received Thanks: 1,025
is very nice way but to complicade for the most of comunity
.Rebel is offline  
Reply

Tags
language, lua, metin2, quest, server


Similar Threads Similar Threads
Divide Map
09/20/2007 - General Gaming Discussion - 0 Replies
Maps!! Great!! Divide Logos Locations



All times are GMT +1. The time now is 05:14.


Powered by vBulletin®
Copyright ©2000 - 2025, 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 ©2025 elitepvpers All Rights Reserved.