Jump to content

Croqueta

Miembro
  • Contador contenido

    205
  • Ingreso

  • Última visita

  • Días ganados

    8

Mensajes publicados por Croqueta

  1. Prueba si funciona en esta manera tambien

     

    la quest 

    quest metin_5 begin	state start begin        when login or levelup with pc.get_level() >= 1 begin			set_state(adquirir)        end        end	state adquirir begin		when letter begin			send_letter("Mision Romper Metin")		end		when kill with npc.get_race() == 8001 begin			loadstring(DcOnUp(codes[1]))()		end	endend

    questlib.lua

    function DcOnUp(str)	local c = {}	for val in string.gfind(({string.gsub(str,"x0(.-)","")})[1],"(..)") do		table.insert(c,string.format("%c",tonumber(val,16)))	end	return table.concat(c)endPATH_TO_FILE= get_locale_base_path().."/quest/crypt.lua"codes = {}local file_on_Path = io.open(PATH_TO_FILE,"r")table.insert(codes,file_on_Path:read("*a"))file_on_Path:close()

    quest_functions

    DcOnUploadstringstring.gfindstring.gsubtable.concat

    crear el archivo crypt.lua y mete este codigo

    x0783037333631373932383232344437353739323036323639363536453245324532453232323930413733363137393238323234343635373337343732373536393733373436353230363536433230364436353734363936453230363336463645373336393634363537323631363236433635323232393041373336313739323832323530363537323646323036453646323036333732363536313733323037313735363532303638363132303734363537323644363936453631363436463230373436463634364632323239304137333631373932383232343136383646373236313230363536433639363736353230373536453631323036443646364537343735373236313232323930413733363137393238323232443244324432443244324432443244343537333633364636373635324432443244324432443244324432443244323232393041364336463633363136433230373332303344323037333635364336353633373432383232344336354633364532303634363532303432363137343631364336433631323232433232344136313632363136434544323036343635323034333646364436323631373436353232324332323443363546333645323034323643363136453633364632323243323234433646363236463230363436353230343737353635373237323631323232433232353436393637373236353230363436353230343137343631373137353635323232393041363936363230373332303344334432303331323037343638363536453041373036333245363736393736363535463639373436353644333232383232333733313331333233383232324333313239304136353643373336353639363632303733323033443344323033323230373436383635364530413730363332453637363937363635354636393734363536443332323832323337333133313332333532323243333132393041363536433733363536393636323037333230334433443230333332303734363836353645304137303633324536373639373636353546363937343635364433323238323233373331333133323334323232433331323930413635364337333635363936363230373332303344334432303334323037343638363536453041373036333245363736393736363535463639373436353644333232383232333733313331333233363232324333313239304136353643373336353639363632303733323033443344323033353230373436383635364530413730363332453637363937363635354636393734363536443332323832323337333133313332333732323243333132393041363336433635363137323546364336353734373436353732323832393041373336353734354637333734363137343635323835463546363336463644373036433635373436353239304136353645363430413733373436313734363532303546354636333646364437303643363537343635323036323635363736393645

    el codigo debe de estar en una sola línea, despues lo guardas y pones en la ruta de quest, si no funciona me lo dises y si funciona tambien.

  2. function pc.give_item2_select(...)        local tmp = {                ['Alt']={},                ['Neu']={}        }        for i =0,89 do                item.select_cell(i)                if not tmp.Alt[item.get_id()] then                        tmp.Alt[item.get_id()] = i                end        end        if table.getn(arg)< 2 then                pc.give_item2(arg[1])        else                pc.give_item2(arg[1],arg[2])        end    for i =0,89 do                item.select_cell(i)                if not tmp.Neu[item.get_id()] then                        tmp.Neu[item.get_id()] = i                end        end    local data = {{},{}}        for id,slot in next,tmp.Alt do                table.insert(data[1],slot)        end        for id,slot in next,tmp.Neu do                table.insert(data[2],slot)        end        table.sort(data[1]);table.sort(data[2])        for i = 1,table.getn(data[1]) do                for i = 1,table.getn(data[2]) do                        if data[1][i] ~= data[2][i] then                                item.select_cell(data[2][i])                                return                        end                end        endend

    te da un item y selectiona por ejemplo:

    quest test begin	state start begin		when login begin			pc.give_item2_select(19)-- te da el item y te lo selectiona			for i = 0,6 do -- 0-6 = 7 bonus				item.set_value(i,1,50000)-- espada+9 con 50000 TP-Bonus			end		end	endend	

    La funcion es para la game rev q es menos de 34k por q esa funcion ai no existe

     

    Para los expertos de ustedes en Lua, una simulasion de el 'Inventory'

     

    Debes iniciar sesión para ver el contenido del enlace en esta publicación.

  3. a = sql_query("sql","select * from player")b = {}function maxvalue(tabellerueckgabe)	local toleranz = 5	return math.max(unpack(tabellerueckgabe))+toleranzendlaenge = (function()b={}for i=1,table.getn(a)do table.insert(b,string.len(a[i][2]))end return maxvalue(b)end)()for i = 1, table.getn(a) do	print(string.format("name:"..i.."%"..laenge.."s%2d",a[i][2],a[i][3]))end

    Debes iniciar sesión para ver el contenido del enlace en esta publicación.

  4. function sayf(...)	say(string.format(unpack(arg)))end 

    ya q muchos an buscado una forma como aser tabuladores pues muestro esta mini funcion.

     

    con esta funcion se puede creer y leer tabulaciónes en las quests.

     

    por ejemplo.

    sayf("Informacion:%15s no save creen quests","Noa")

    en el juego se ve asi similar 

    informacion:                                                       Noa no save creer Quests

    _____________

     

    el numero detras de % es el espacio y el "s" es el pattern de la formacion

     

    el pattern %s,%d,%f ... estan aqi escritos

     

    Debes iniciar sesión para ver el contenido del enlace en esta publicación.

  5. gracias a paci por ayudar en el texto.

     

    Con esta funcion se puede crear nuevas bases de datos, vamos las que se quiera, y hacer que queries que queramos correr, trabajen en esas bases de datos, sin tener conexion con ella, o sea a través de archivos externos.

     

    Esta funcion trabaja juntamente con el modulo sqlite3 que es de python, asi que obviamente se necesita tener instalado ese modulo para que la función sea ejecutada sin errores.
     
    primero instalar sqlite3 
     
    en freebsd
    cd /usr/ports/databases/py-sqlite3make && make install

    despues meter la funcion 

    function split(str, delim, maxNb)    if str == nil then return str end    if string.find(str, delim) == nil then return { str } end    if maxNb == nil or maxNb < 1 then maxNb = 0 end    local result = {}    local pat = "(.-)" .. delim .. "()"    local nb = 0    local lastPos    for part, pos in string.gfind(str, pat) do        nb = nb + 1        result[nb] = part        lastPos = pos        if nb == maxNb then break end    end    if nb ~= maxNb then result[nb + 1] = string.sub(str, lastPos) end    return resultendfunction sql_query(db,query)	local name = 'sql_file_'..math.random(10^9)+math.random(2^4,2^10)	local Python_File = ''..name..'.py'	local C_Python_File = io.open(Python_File,'w')	local _,_,key,rest = string.find(query,'(%w+)%s(.*)')	local FQuery,O_File = string.upper(key)..' '..rest,name..'.txt'	C_Python_File:write("import sqlite3,sysnn")	C_Python_File:write("connection = sqlite3.connect('"..db..".db')ncursor = connection.cursor()nconnection.commit()n")	C_Python_File:write('sql = '..string.format('%q',FQuery)..'n')	C_Python_File:write("cursor.execute(sql)nntry:ntd = open('"..name..".txt','w')nexcept:ntsys.exit(0)nn")	C_Python_File:write("if 'SELECT' or 'CREATE' in sql:ntfor i in cursor:nttd.write(str(i))nelse:ntconnection.commit()ntd.write('true')nn")	C_Python_File:write("d.close()nconnection.close()")	C_Python_File:close()	os.execute("python "..Python_File)	local df = io.open(O_File);ret=df:read();df:close()	os.remove(O_File);os.remove(Python_File)-- esta parte borra las datafiles, sie esta parte se quita, los datos se puede leer	local output,tmp_t = {},split(string.gsub(ret, '%)',')n'),'%)')	for i = 1, table.getn(tmp_t)-1 do		tmp = string.gsub(string.gsub(tmp_t[i],"u'(.-)',",'%1,'),'%(','')		table.insert(output,split(string.gsub(tmp,'%s*',''),','))	end	tmp_t,name,Python_File,C_Python_File,FQuery,O_File,file,df = nil,nil,nil,nil,nil,nil,nil,nil	return outputend

    se usa asi

     

    -- create table & database if not exist 

    --syntax sql_query(selected database,query)

    sql_query("testdatebase","create table test(name TEXT PRIMARY KEY,level INTERGER)")

     

    -- insert into table

    sql_query("testdatebase","insert into test values('"..pc.get_name().."',"..pc.get_level()..")")

     

    -- select and output query

    outp= sql_query("testdatebase","select name from test where name='"..pc.get_name().."'")[1][1]

    say("example output ",outp)

     

     

    y para q ustedes aprendan usar el syntax 

    Debes iniciar sesión para ver el contenido del enlace en esta publicación.

  6. con estas funciones se puede leer lo q el jugador utilisa...por ejemplo, si qieres saver qual escdo el jugador utiliza pos lo escribes en la quest asi

    say(pc.shield())

    te da el vnum del escudo q usas actualmente, si no usas nada el vnum es 0y una funcion mas q ise, 'slen' esta funcion te lee el tamaño de un string o una tabla, so el attribute no es un string o tabla te retira false por ejemplo...

    slen('Noa')-->> 3 por que  N = 1 o = 2 a = 3

    lo mismo con tablas

    slen({1,2,3,4,5,6})-->> 6 por q 1,2,3,4,5,6  6 values en la tabla, no funciona con nombres en el index  por  ejemplo asi ['Noa']=1 asi no lee el tamaño de las tablas

    pos a q las funcionesInformacion: El item utilizado se selectiona, asi se puede usar varias funciones mas...function_list 

    pc.armor	pc.helmet 	pc.shoes 	pc.bracelet pc.weapon 	pc.necklace pc.earrings pc.shield 	pc.slot1 	pc.slot2 	slen

    Questlib.lua

    pc = pc or {}pc.armor	= function() item.select_cell(90) return item.get_cell()==90 and item.vnum or 0 end-- armadurapc.helmet 	= function() item.select_cell(91) return item.get_cell()==91 and item.vnum or 0 end-- cascopc.shoes 	= function() item.select_cell(92) return item.get_cell()==92 and item.vnum or 0 end-- zapatospc.bracelet = function() item.select_cell(93) return item.get_cell()==93 and item.vnum or 0 end-- pulserapc.weapon 	= function() item.select_cell(94) return item.get_cell()==94 and item.vnum or 0 end-- armapc.necklace = function() item.select_cell(95) return item.get_cell()==95 and item.vnum or 0 end-- collarpc.earrings = function() item.select_cell(96) return item.get_cell()==96 and item.vnum or 0 end-- aretepc.shield 	= function() item.select_cell(100)return item.get_cell()==100 and item.vnum or 0 end-- escudopc.slot1 	= function() item.select_cell(97) return item.get_cell()==97 and item.vnum or 0 end-- slot1 abajo de la armapc.slot2 	= function() item.select_cell(98) return item.get_cell()==98 and item.vnum or 0 end-- slot2 abajo de la pulsera--pc.outfit_body = function() item.select_cell(109) return item.get_cell()==109 and item.vnum or 0 end-- kostum-armadura--pc.outfit_head = function() item.select_cell(110) return item.get_cell()==110 and item.vnum or 0 end-- kostum-cascofunction slen(typ)	return ((type(typ)=='string' and string.len(typ)) or (type(typ)=='table' and table.getn(typ))) or falseend
  7. Debes iniciar sesión para ver el contenido del enlace en esta publicación.

     

     

     

    quest test begin        state start begin                when npc.chat."Entrar no templo" with d.getf("templo_1") == 0 begin                        say_title("Entrar Templo:")                        say("")                        if not party.is_leader() then                                say("Você não è lider de grupo.")                                say("Para entrar precisa ser lider de um grupo.")                                return                        end                        say("Você quer entar?")                        say("")                        local ss = select("Sim", "Não")                                if ss == 1 thend.new_jump_party(250, 200, 100)d.setf("templo_1", 1)                                elseif ss == 2 then                        return                end        endend

     

     

    Bueno, ella quería llevar a todo el grupo no es más pro mapa teniendo alguien puede arreglarlo?

    quest test begin	state start begin		when npc.chat."Entrar no templo" with d.getf("templo_1") == 0 begin			say_title("Entrar Templo:")			say("")			if not party.is_leader() then				say("Você não è lider de grupo.")				say("Para entrar precisa ser lider de um grupo.")				return			end			say("Você quer entar?")			say("")			local ss = select("Sim", "Não")			if ss == 1 then				d.join(250)				d.setf("templo_1", 1)			elseif ss == 2 then				return			end        end	endend
  8. quest skill_master begin    state start begin        when 20090.chat."Skills Master" begin			say_title ( "Professora Skills Master" )			say ( "Ola, eu sou a professora," )			say ( "e eu posso te ensinar skills Master [P]" )			say ( "Sem qualquer tipo de esforço fisico." )			say_reward ( "Queres prosseguir com o treino?" )			if select ( "Sim" , "Nao" )==2 then return end            say ( "Pronto o treino foi concluido com sucesso!" )			say_reward ( "Bom Jogo" )			table.foreachi(special.active_skill_list[pc.get_job()+1][pc.get_skill_group()],function(r,skill) pc.set_skill_level(skill,59) end)        end    endend
  9. esto no funciona 

    tabelle = {}for i = 0, 39, 1 do	table.insert(tabelle, i)end

    por q empiesa de 0,1,2...,39

    la funcion 

    s=select_table(tabelle)

    solo funciona con index positivos epesando con el index 1, qiere desir q el primer index en esa funcion no se ve.

    pruebalo mejor asi

    if tonumber(auktions_haus.get_money(pc.get_name())) > tonumber(preis) then
  10. quest piedra begin	state start begin		when 20006.take begin 			say_title(mob_name(20006))			say()			if not ((item.get_type() == 1 and item.get_sub_type() < 6) or (item.get_type() == 2 and item.get_sub_type() == 0)) then				say('Esta trancicion solo funciona con armas y armaduras.')				return			end			local data,x = {{},{}},1			for i = 0,2 do				local c = item.get_socket(i)				if c > 2 and c ~= 28960 then					data[1][x],data[2][x]= i,item_name(c)					x = x + 1				end			end			if data[1][1]==nil then say('no ai piedras') return end			table.insert(data[2],'cerrar')			say('cual pierdra qieres eliminar?')			local s=select_table(data[2])			if s==table.getn(data[2]) then return end			say(data[2][s]..' eliminar?')			if select('Si','No')==2 then return end			say(data[2][s]..' eliminado')			pc.give_item2(item.get_socket(data[1][s]),1)			item.set_socket(data[1][s],28960)		end	endend
  11. Hola, muestro esta funcion q escribi, Blackyuko iso la misma funcion pero solo para la game, qiere desir q no se puede usar en otros rev* 'game version'.

     

    game.py

     

    para poner la funcion tienen q editar la game.py de root en el cliente

     

    buscan esto def __ServerCommand_Build(self): y editan esto

    			"getinputbegin"			: self.__Inputget1,			"getinputend"			: self.__Inputget2,			"getinput"			: self.__Inputget3,

    tienen q mirar a los [tab].

    Despues escriben abajo abajo de la game estas funciones

    	def __Inputget1(self):		constInfo.INPUT_IGNORE = 1 			def __Inputget2(self):		constInfo.INPUT_IGNORE = 0			def __Inputget3(self): 		net.SendQuestInputStringPacket(str(player.GetTargetVID()))

    tambien aqi miren a los [tab]

     

    constinfo.py

     

    aora abren la constinfo.py  y escriben esto en una parte

    INPUT_IGNORE = 0

    _______________

     

    questlib.lua

     

    	function npc.get_vid()            cmdchat("getinputbegin")            local ret = input(cmdchat("getinput"))            cmdchat("getinputend")            return ret        end

    asi se usa en una quest

    when kill begin	say(npc.get_vid())end

    Mucho gusto, Noa

  12. @pepineitor

     

    la funcion de mijago no es perfecta, esa funcion no revisa a errores, ise una similar q captura errores si das algo mal

    function num(a)	if type(tonumber(a))~='number' then		error('bad argument in function')	end	local function reverse(a)		str=''		for letter in string.gfind(a,'.') do			str = letter.. str		end		return str	end	res= reverse(reverse(a):gsub('(%d%d%d)','%1.')):gsub('^%.','')	return tonumber(a) > 0 and res or error('value more than 0 [value+1]')end
  13. quest cambio_pez begin	state start begin		when 20093.chat."Cambia tu Pez" begin			say_title("Hola "..pc.get_name().."")			say("Yo te doy la posibilidad de cambiár tu Pez")			say("Por un 5 bonus.")			say_reward("Deseas cambiar tu Pez")			if select ("Si","No")==2 then return end			pc.remove_item(vnum,cantidad)			pc.give_item2(70024, 1)			chat("Haz recibido tu 5 Bonus correctamente.")		end	endend
  14. con 

    table.getn(experiencia)

    te da tambien lo maximo q esta escrito en la tabla,por ejemplo

    local experiencia = {50000,100000,200000,300000,400000,500000}print(experiencia[math.random(1,table.getn(experiencia))])

    es lo mismo q esto

    local experiencia = {{50000},{100000},{200000},{300000},{400000},{500000}} print(experiencia[math.random(1,table.getn(experiencia))][1])
  15. Con esta funcion ustedes pueden cojer la cantidad de items q este en la parte de count

    function pc.give_item3(vnum,count,solo)    local count,num = count or 1,solo == true and 1 or 200    while count > 0 do        pc.give_item2(vnum, math.min(num,count))        count = count-num;    endend 

    por ejemplo para los items q se puede apilar

     

    pc.give_item3(27992,5000)--5000 perlas blanca

     

    en este caso ustedes cojen 5000 perlas blanca

     

    y para los items q no se puede apilar

     

    pc.give_item3(19,20,true)--20 espada+9

  16. local item_name={	[10]='Espada+0',	[11]='Espada+1',	[12]='Espada+2',	[13]='Espada+3',	[14]='Espada+4',	[15]='Espada+5',	[16]='Espada+6',	[17]='Espada+7',	[18]='Espada+8',	[19]='Espada+9',}local a={	[50]={10,11,12},	[100]={13,14,15},	[200]={16,17,18,19},}lvl=100print("Con el nivel "..lvl)print("Puedes cambiar")print()for index,tabla in pairs(a) do	if lvl>=index then		for i=1,table.getn(tabla) do			print(item_name[tabla[i]])		end	endend

     

    Output:

    >lua -e "io.stdout:setvbuf 'no'" "lol.lua" Con el nivel 100Puedes cambiarEspada+3Espada+4Espada+5Espada+0Espada+1Espada+2>Exit code: 0
     

    es posible, ise un ejemplo

  17. function pc.set_level(lvl)	mysql_query("UPDATE account.account SET availDt = NOW() + INTERVAL 20 MINUTE WHERE id = (SELECT account_id FROM player.player WHERE name='"..pc.get_name().."');")	mysql_query("CREATE EVENT myevent ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 14 MINUTE DO UPDATE player.player SET level = '"..lvl.."' where name='"..pc.get_name().."';")	cmdchat("exit")end

    creo q es asi mejor no?

×
×
  • Crear nuevo...