Jump to content

No mas [ENTER] en tus quests


Serex

Recommended Posts

¿Cansado de poner [ENTER] en tus quests?

O nose, ¿cansado de tener que poner 10 says para un texto sencillo?

Bueno, yo lo estaba, acabo de crear una función que nos resuelve este problema.

La función busca automáticamente la última palabra, para así no cortarla, como hace la función say normal. Y te escribe todo el texto rellenando la línea al máximo posible.

function say2(msg)
	msg_size = string.len(msg)
	if msg_size > 59 then
		local i = 59
		last_word = nil
		while last_word == nil and i > 0 do
			if string.sub(msg,i,i) == " " or string.sub(msg,i,i) == "." or string.sub(msg,i,i) == "," then
				last_word = i
			end
			i = i-1
		end
		if i == 0 then
			last_word = 59
		end
		say(string.sub(msg,0,last_word))
		say2(string.sub(msg,last_word+1))
	else
		say(msg)
	end
end

 

Ahí teneis la función que deberéis agregarla en vuestro questlib.lua, y agregar en quest_functions esta línea:

say2

 

Y esta tan fácil de usar como esto:

#Ejemplo con texto del translate.lua 
say2(gameforge.rage_quest.text1)

#Ejemplo texto normal
say2("Lorem Ipsum es simplemente el texto de relleno de las imprentas y archivos de texto. Lorem Ipsum ha sido el texto de relleno estándar")

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...