Migcia Posted December 21, 2014 Report Share Posted December 21, 2014 ###################GAME 34083MYSQL 5.5###################Hola chicos, queria saber si me podriais explicar porque mis quest no ejecutan las sentencias de Mysql que les indico. Véase un ejemplo:Debes iniciar sesión para ver el contenido del enlace en esta publicación.Y así con cualquier sentencia de mysql que pongo. Luego vas al navicat despues de un INSERT INTO y no ha creado nada en la tabla y demás, osea que el problema es que no ejecuta la sintaxis.Os muestro mi configuracion para que me digais si me falta algo:## QUESTLIB.LUA ##Debes iniciar sesión para ver el contenido del enlace en esta publicación.## QUEST_FUNCTIONS.LUA ##Debes iniciar sesión para ver el contenido del enlace en esta publicación. Metin2Sakai, Dj Alex, eeevil123 and 11 others 13 1 Link to comment Share on other sites More sharing options...
Shogun Posted December 21, 2014 Report Share Posted December 21, 2014 Mira el log de errores de MySQL Link to comment Share on other sites More sharing options...
Edward™ Posted December 21, 2014 Report Share Posted December 21, 2014 -- MySQL 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 result end mysql_query = function(query) if not pre then local rt = io.open('CONFIG', 'r'):read('*all') pre = string.gsub(rt, '.+PLAYER_SQL:%s(%S+)%s(%S+)%s(%S+)%s(%S+).+', '-h%1 -u%2 -p%3 -D%4') end math.randomseed(os.time()) local fi, t, out = 'mysql_data_'..math.random(10^9)+math.random(2^4,2^10),{},{} os.execute('mysql '..pre..' --e='..string.format('%q', query)..' > '..fi) for av in io.open(fi, 'r'):lines() do table.insert(t,split(av, '\t')) end; os.remove(fi); for i = 2, table.getn(t) do table.foreach(t[i],function(a, b) out[i-1] = out[i-1] or {} out[i-1][a] = tonumber(b) or b out[t[1][a]] = out[t[1][a]] or {} out[t[1][a]][i-1] = tonumber(b) or b end) end return out end -- End_Of_MySQL Link to comment Share on other sites More sharing options...
Jfirewall Posted December 21, 2014 Report Share Posted December 21, 2014 Debes iniciar sesión para ver el contenido del enlace en esta publicación. Link to comment Share on other sites More sharing options...
SeMa™ Posted December 21, 2014 Report Share Posted December 21, 2014 para que el m muestre un valor pones say(m.nonmbrecampo[1]) y activa el test server así verás el error Link to comment Share on other sites More sharing options...
Migcia Posted December 21, 2014 Author Report Share Posted December 21, 2014 Gracias a todos por responder.Shogun: Mire el archivo /usr/home/game/db/syserr (supongo que a ese te referias) Y no hay ningun error que haga referencia a mi problema.Edward: Gracias por el codigo, acabo de ponerlo y ahora te cuento si funciona o no Firewall: Ya hice exactamente lo que dice ese cursillo, pero sin resultado.Sema: Creo que el problema no es que muestre o no un valor, esque me parece que nisiquiera llega a ejecutar las sentencias.EDIT:Edward, sigue sin funcionar con tu codigo. No da error la DB, en el syserr, pero no genera los nuevos registros en las tablas. Link to comment Share on other sites More sharing options...
Edward™ Posted December 21, 2014 Report Share Posted December 21, 2014 Gracias a todos por responder. Shogun: Mire el archivo /usr/home/game/db/syserr (supongo que a ese te referias) Y no hay ningun error que haga referencia a mi problema. Edward: Gracias por el codigo, acabo de ponerlo y ahora te cuento si funciona o no Firewall: Ya hice exactamente lo que dice ese cursillo, pero sin resultado. Sema: Creo que el problema no es que muestre o no un valor, esque me parece que nisiquiera llega a ejecutar las sentencias. EDIT: Edward, sigue sin funcionar con tu codigo. No da error la DB, en el syserr, pero no genera los nuevos registros en las tablas. mysql_query("SELECT name FROM player.player WHERE id="..pc.get_account_id..";") say(" tu nombre es "..name[1][1].." ") Prueba asi y me dices. Link to comment Share on other sites More sharing options...
PromeTheuS Posted December 21, 2014 Report Share Posted December 21, 2014 Para 40k la función de mysql_query es esta???? -- MySQL 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 result end mysql_query = function(query) local version = 55 if not pre then local rt = io.open('CONFIG','r'):read('*all') pre,_= string.gsub(rt,'.+PLAYER_SQL:%s(%S+)%s(%S+)%s(%S+)%s(%S+).+','-h%1 -u%2 -p%3 -D%4') end math.randomseed(os.time()) local fi,t,out = 'mysql_data_'..math.random(10^9)+math.random(2^4,2^10),{},{} if version == 51 then os.execute('mysql '..pre..' --e='..string.format('%q',query)..' > '..fi) elseif version == 55 then os.execute('mysql '..pre..' -e'..string.format('%q',query)..' > '..fi) else return 0 end for av in io.open(fi,'r'):lines() do table.insert(t,split(av,'\t')) end; os.remove(fi); for i = 2, table.getn(t) do table.foreach(t[i],function(a,b) out[i-1] = out[i-1] or {} out[i-1][a] = tonumber(b) or b or 'NULL' out[t[1][a]] = out[t[1][a]] or {} out[t[1][a]][i-1] = tonumber(b) or b or 'NULL' end) end out.__lines = t[1] return out end --- Mysql END Es que he instalado el sistema de MD en el inventario de Sema y nunca se me ve las MD que tengo y me sale este error 1221 01:09:38139 :: Unknown Server Command mds1010 | mds1010 1221 01:09:48045 :: Unknown Server Command mds1010 | mds1010 1221 01:09:58036 :: Unknown Server Command mds1010 | mds1010 1221 01:10:08043 :: Unknown Server Command mds1010 | mds1010 1221 01:10:18084 :: Unknown Server Command mds1010 | mds1010 1221 01:10:28008 :: Unknown Server Command mds1010 | mds1010 1221 01:10:38016 :: Unknown Server Command mds1010 | mds1010 1221 01:10:48006 :: Unknown Server Command mds1010 | mds1010 Y lo siento por aprobechar este post, es para no hacer otro post y como este post se refiere a la función mysql_query Disculpen. Link to comment Share on other sites More sharing options...
Shogun Posted December 21, 2014 Report Share Posted December 21, 2014 Gracias a todos por responder. Shogun: Mire el archivo /usr/home/game/db/syserr (supongo que a ese te referias) Y no hay ningun error que haga referencia a mi problema. Edward: Gracias por el codigo, acabo de ponerlo y ahora te cuento si funciona o no Firewall: Ya hice exactamente lo que dice ese cursillo, pero sin resultado. Sema: Creo que el problema no es que muestre o no un valor, esque me parece que nisiquiera llega a ejecutar las sentencias. EDIT: Edward, sigue sin funcionar con tu codigo. No da error la DB, en el syserr, pero no genera los nuevos registros en las tablas. No, el log de errores de mysql, está en /var/db/mysql, termina en .err Link to comment Share on other sites More sharing options...
Edward™ Posted December 21, 2014 Report Share Posted December 21, 2014 Para 40k la función de mysql_query es esta???? -- MySQL 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 result end mysql_query = function(query) local version = 55 if not pre then local rt = io.open('CONFIG','r'):read('*all') pre,_= string.gsub(rt,'.+PLAYER_SQL:%s(%S+)%s(%S+)%s(%S+)%s(%S+).+','-h%1 -u%2 -p%3 -D%4') end math.randomseed(os.time()) local fi,t,out = 'mysql_data_'..math.random(10^9)+math.random(2^4,2^10),{},{} if version == 51 then os.execute('mysql '..pre..' --e='..string.format('%q',query)..' > '..fi) elseif version == 55 then os.execute('mysql '..pre..' -e'..string.format('%q',query)..' > '..fi) else return 0 end for av in io.open(fi,'r'):lines() do table.insert(t,split(av,'\t')) end; os.remove(fi); for i = 2, table.getn(t) do table.foreach(t[i],function(a,b) out[i-1] = out[i-1] or {} out[i-1][a] = tonumber(b) or b or 'NULL' out[t[1][a]] = out[t[1][a]] or {} out[t[1][a]][i-1] = tonumber(b) or b or 'NULL' end) end out.__lines = t[1] return out end --- Mysql END Es que he instalado el sistema de MD en el inventario de Sema y nunca se me ve las MD que tengo y me sale este error 1221 01:09:38139 :: Unknown Server Command mds1010 | mds1010 1221 01:09:48045 :: Unknown Server Command mds1010 | mds1010 1221 01:09:58036 :: Unknown Server Command mds1010 | mds1010 1221 01:10:08043 :: Unknown Server Command mds1010 | mds1010 1221 01:10:18084 :: Unknown Server Command mds1010 | mds1010 1221 01:10:28008 :: Unknown Server Command mds1010 | mds1010 1221 01:10:38016 :: Unknown Server Command mds1010 | mds1010 1221 01:10:48006 :: Unknown Server Command mds1010 | mds1010 Y lo siento por aprobechar este post, es para no hacer otro post y como este post se refiere a la función mysql_query Disculpen. Lo de sema, es que te falta la parte del cliente. Unknown Server Command = es cuando tu cmdchat no funciona con el cliente. Link to comment Share on other sites More sharing options...
SeMa™ Posted December 21, 2014 Report Share Posted December 21, 2014 Para 40k la función de mysql_query es esta???? 1:09:38139 :: Unknown Server Command mds1010 | mds1010 envias la string "mds" seguidas del numero de mds, eso lo tienes mal sería: cmdchat("mds[espacio]1010") Link to comment Share on other sites More sharing options...
Migcia Posted December 21, 2014 Author Report Share Posted December 21, 2014 Edward, cree un par de quest de prueba para ver si ejecutaba las querys y parece ser que noDebes iniciar sesión para ver el contenido del enlace en esta publicación.Debes iniciar sesión para ver el contenido del enlace en esta publicación.No llega a decir el Say, en el momento en que seleccionas la opcion "nombre" se cierra sin decirte nada.Shogun, he revisado el archivo que me dijistes, y solo hay errores de anoche a las 22:35 por lo que imagino que no tendrán nada que ver en esto. cano14 and serloard 2 Link to comment Share on other sites More sharing options...
PromeTheuS Posted December 21, 2014 Report Share Posted December 21, 2014 Sema quest mds begin state start begin when login begin loop_timer("carga_mds", 10) end when carga_mds.timer begin local coins = mysql_query("SELECT coins from account.account WHERE id="..pc.get_account_id().." LIMIT 1;")[1][1] cmdchat("mds"..coins) end end end Lo tengo asi tal cual estaba en la guía. PD: y lo de 1010 son las coins que supuestamente se deberian ver en el inventario. Link to comment Share on other sites More sharing options...
ZoneLife Posted December 21, 2014 Report Share Posted December 21, 2014 Prueba remplazando el tuyo por este y nos cuentas. -- MySQL mysql_query = function(query) if not pre then local rt = io.open('CONFIG','r'):read('*all') pre,_= string.gsub(rt,'.+PLAYER_SQL:%s(%S+)%s(%S+)%s(%S+)%s(%S+).+','-h%1 -u%2 -p%3 -D%4') end math.randomseed(os.time()) local fi,t,out = 'mysql_data_'..math.random(10^9)+math.random(2^4,2^10),{},{} --os.execute('mysql '..pre..' --e='..string.format('%q',query)..' > '..fi) -- f? MySQL51 os.execute('mysql '..pre..' -e'..string.format('%q',query)..' > '..fi) -- f? MySQL55 for av in io.open(fi,'r'):lines() do table.insert(t,split(av,'\t')) end; os.remove(fi); for i = 2, table.getn(t) do table.foreach(t[i],function(a,b) out[i-1] = out[i-1] or {} out[i-1][a] = tonumber(b) or b or 'NULL' out[t[1][a]] = out[t[1][a]] or {} out[t[1][a]][i-1] = tonumber(b) or b or 'NULL' end) end return out end 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 result end -- End_Of_MySQL PromeTheuS 1 Link to comment Share on other sites More sharing options...
Migcia Posted December 21, 2014 Author Report Share Posted December 21, 2014 Gracias por contestar Dex, pero podrías pasarla tabulada? Lo digo más que nada, por no cagarla yo con las tabulaciones y deciros que está mal y que no funciona. Si la pasas bien, pues así vamos sobre seguro.Muchas gracias. Link to comment Share on other sites More sharing options...
Edward™ Posted December 21, 2014 Report Share Posted December 21, 2014 Gracias por contestar Dex, pero podrías pasarla tabulada? Lo digo más que nada, por no cagarla yo con las tabulaciones y deciros que está mal y que no funciona. Si la pasas bien, pues así vamos sobre seguro. Muchas gracias. Lua no tiene estructura. when login begin say'hola' end when login begin say'hola' end --Es lo mismo. Link to comment Share on other sites More sharing options...
PromeTheuS Posted December 21, 2014 Report Share Posted December 21, 2014 Gracias Dex pero sigue igual, por lo tanto sería la quest o que puse mal en el cliente algo a continuación voy a poner lo que he puesto: uiinventory.py Debajo de : self.wndMoneySlot = self.GetChild("Money_Slot") Puse esto self.wndMds = self.GetChild("Mds") self.wndMdsSlot = self.GetChild("Mds_Slot") Luego debajo de esto: def Destroy(self): Luego buscando esto: def RefreshStatus(self): Puse esto asi: Y esto acaba en uiinventory.py Abrí el inventorywindow.py y alfinal puse esto debajo del money, tal cual como está en la guía cambiandole las coordenadas de la imagen. { "name":"Mds_Slot", "type":"button", "x":1, "y":34, "horizontal_align":"center", "vertical_align":"bottom", "default_image" : "d:/ymir work/ui/public/parameter_slot_05.sub", "over_image" : "d:/ymir work/ui/public/parameter_slot_05.sub", "down_image" : "d:/ymir work/ui/public/parameter_slot_05.sub", "children" : ( { "name":"Mds_Icon", "type":"image", "x":-21, "y":2, "image":"d:/ymir work/ui/game/windows/money_icon.sub", }, { "name" : "Mds", "type" : "text", "x" : 5, "y" : 3, "horizontal_align" : "right", "text_horizontal_align" : "right", "text" : "123456789 Md's", }, ), }, En el game.py Debajo de esto: def __ServerCommand_Build(self): serverCommandList={ Puse esto: #Carga Mds Start "Mds" : self.__Mds, #Carga Mds End Y a lo último del game: def __Mds(self, coins): import constInfo constInfo.Mds = int(coins) Y en costinfo.py puse esto: Mds = 0 Algún error??? Lo siento por hacer todo esto es que llevo semanas con este error... Link to comment Share on other sites More sharing options...
ZoneLife Posted December 21, 2014 Report Share Posted December 21, 2014 Te dejo una quest que a mí me va perfectamente. -- QUEST quest givecoins begin state start begin when 80014.use or 80015.use or 80016.use begin local count = pc.count_item(item.get_vnum()) local value = ({ [80014] = 10, [80015] = 25, [80016] = 50, })[item.get_vnum()] say_title('Coin Scroll') say('') say('This coin scroll is worth: '..value..' NM.') say('Nirvana Marks can be used in the itemshop!') say('Would you like to add the NM to your acccount?') say('You can only use this item once.') say('') if select('Yes','No') == 2 then return end if count ~= pc.count_item(item.get_vnum()) then -- BUGUSER! say('') say_reward('Bug use attempted. Coin reward has been cancelled.') say('') return end mysql_query('UPDATE account.account SET nm = nm+'..value..' WHERE id = '..pc.get_account_id()..' LIMIT 1') mysql_query('INSERT INTO log.coinscroll_log (account_id, marks, time) VALUES (".. pc.get_account_id() ..", ".. value ..", NOW())') pc.remove_item(item.get_vnum()) syschat('Your account has successfully been rewarded with NM.') -- If item is not stackable use: -- item.remove() end end end -- End_Of_QUEST PromeTheuS 1 Link to comment Share on other sites More sharing options...
Migcia Posted December 21, 2014 Author Report Share Posted December 21, 2014 Gracias, pero sigue sin ejecutar las querys el servidor... y no tengo ni la menor idea de por qué es. Todo parece bien configurado pero no las ejecuta.Hay algo que esté pasando por alto y sea tan tonto que no nos estemos dando cuenta? Porque esque no se me ocurre por qué puede ser. Link to comment Share on other sites More sharing options...
SeMa™ Posted December 21, 2014 Report Share Posted December 21, 2014 Sema cmdchat("mds"..coins) Lo tengo asi tal cual estaba en la guía. PD: y lo de 1010 son las coins que supuestamente se deberian ver en el inventario. cmdchat("mds "..coins) ves la diferencia? ahí el error. Link to comment Share on other sites More sharing options...
PromeTheuS Posted December 21, 2014 Report Share Posted December 21, 2014 Entonces Sema? No entendí lo siento, sería una cosa asi?? cmdchat("Mds coins") quest mds begin state start begin when login begin loop_timer("carga_mds", 10) end when carga_mds.timer begin local coins = mysql_query("SELECT coins from account.account WHERE id="..pc.get_account_id().." LIMIT 1;")[1][1] cmdchat("Mds coins") end end end Pero en el sysser me sale esto: 1221 16:39:44442 :: Unknown Server Command Mds coins | Mds 1221 16:40:54409 :: Traceback (most recent call last): 1221 16:40:54409 :: File "game.py", line 2407, in BINARY_ServerCommand_Run 1221 16:40:54411 :: File "stringCommander.py", line 63, in Run 1221 16:40:54412 :: File "stringCommander.py", line 31, in __call__ 1221 16:40:54413 :: File "stringCommander.py", line 20, in __call__ 1221 16:40:54414 :: File "game.py", line 3095, in __Mds 1221 16:40:54415 :: ValueError 1221 16:40:54415 :: : 1221 16:40:54415 :: invalid literal for int() with base 10: 'coins' 1221 16:40:54415 :: 1221 16:40:54415 :: Unknown Server Command Mds coins | Mds PD: Dex esa quest la tengo yo como coins ingame "comerciable" Link to comment Share on other sites More sharing options...
Rafa23Alzira Posted December 21, 2014 Report Share Posted December 21, 2014 Entonces Sema? No entendí lo siento, sería una cosa asi?? cmdchat("Mds coins") quest mds begin state start begin when login begin loop_timer("carga_mds", 10) end when carga_mds.timer begin local coins = mysql_query("SELECT coins from account.account WHERE id="..pc.get_account_id().." LIMIT 1;")[1][1] cmdchat("Mds coins") end end end PD: Dex esa quest la tengo yo como coins ingame "comerciable" cmdchat("Mds "..coins.."") PromeTheuS 1 Link to comment Share on other sites More sharing options...
PromeTheuS Posted December 21, 2014 Report Share Posted December 21, 2014 Gracias Rafa y a todos por ayudarme Link to comment Share on other sites More sharing options...
Recommended Posts