• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Function] isSpell(spell, lower) returns true or false

Renusek

beton beton beton punk!
Joined
Jul 24, 2008
Messages
1,047
Reaction score
9
Location
Poland - Katowice/Ruda Śląska
Hello, I've wrote some time ago a function and just found it inside my fapfolder(don't ask...).

So I'm posting it, maybe someone will find it usefull.

Lua:
local XML = ''
do
	local o = io.open('spells.xml','r')
	XML = o:read('*a')
	o:close()
end

--isSpell(string spell[, bool lower = false])
function isSpell(txt, lower)
	lower = false or lower
	if lower == true then
		txt = tostring(txt):lower()
		XML = tostring(XML):lower()
	end

	if XML:match('<instant name="' .. txt .. '".->(.-)</instant>')
		or XML:match('<instant(.-)words="' .. txt .. '".->(.-)</instant>')
		or XML:match('<conjure name="' .. txt .. '".->(.-)</conjure>')
		or XML:match('<conjure(.-)words="' .. txt .. '".->(.-)</conjure>') then
		return true
	end
	return false
end

And some tests:
Lua:
print(isSpell('exura gran'), -- instant words
	isSpell('adura VITA', true), -- conjure words
	isSpell('Intense Healing', true), -- instant name
	isSpell('Conjure Arrow', true), -- conjure name
	isSpell('this wont work')
	)
print(os.clock())
returned:
true true true true false
0.366

Yours,
Renusek.
 
Last edited:
*noob mode on*
Co tylko chcesz, sam musisz wymyślić jak tego można użyć. Ja zrobiłem komendę !spell exura i mi wypisuje parametry spella.
*noob mode off*

Sry for that -.-'.
 
I co se z tym moge zrobic ? ^.-
if getPlayerPos(cid...) and isSpell('Great Energy Beam', true) then
doTransformItem(...)

Mi przyszedł na myśl pomysł o rozwalaniu serii kolumn vis luxem na potrzebę jakiegoś questa ^.-
 
Back
Top