• 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!

Lua Free Blessing Stone Problem.

Vikarious

New Member
Joined
Dec 16, 2008
Messages
93
Reaction score
2
I'm using the script of Blessing Stone from this thread http://otland.net/f16/free-blessing-stone-165759/.

It wasn't working at all for bad formatation at "7" part.

I did change it, now it loads properly, but when I do click the item I set up to give you the blessing console returns this error:

Code:
[16/08/2012 09:56:52] Lua Script Error: [Action Interface] 
[16/08/2012 09:56:53] data/actions/scripts/blessing/blessing stone.lua:onUse
[16/08/2012 09:56:53] data/actions/scripts/blessing/blessing stone.lua:7: attempt to call global 'isExhausted' (a nil value)
[16/08/2012 09:56:53] stack traceback:
[16/08/2012 09:56:53] 	[C]: in function 'isExhausted'
[16/08/2012 09:56:53] 	data/actions/scripts/blessing/blessing stone.lua:7: in function <data/actions/scripts/blessing/blessing stone.lua:1>

Script:
Lua:
function onUse(cid, item, frompos, item2, topos) 
 
local b = 1,5
local storageValue = 7000
local exhaustTime = 604800
 
	if(isExhausted(cid, storageValue, exhaustTime)) then
		doPlayerSendDefaultCancel(cid, "Sorry you only can use this item after 7 days.")
                return TRUE
        end            
 
	if not getPlayerBlessing(cid, b) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You already have all blessings.")
	else
			doCreatureSetDropLoot(cid, false)
			doPlayerAddBlessing(cid, b)
			setExhaust(cid, storageValue)
			doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have been blessed by the war gods!")
	end
return true
end

I set up this script to work due to click an Oracle statue.

Can it be fixed?

I'm using The Forgotten Server - Version 0.2.13 (Mystic Spirit) 9.54

Thanks in advance!!

I'll try to work on it, but fail badly at scripting, any helps are more than welcomed, when it works I'll post on original thread too.

Many thanks!
 
The only thing I could recommend is breaking the script up and seeing which part of it isnt working. Its apparent that your isExhausted is nil because one of hte parameters isn't correct.

Try something like this

Code:
doCreatureSay(cid, cid, TALKTYPE_SAY)
doCreatureSay(cid, storageValue, TALKTYPE_SAY)
doCreatureSay(cid, exhaustTime, TALKTYPE_SAY)

if isExhausted(cid, storageValue, exhaustTime) then
doCreatureSay(cid, '1', TALKTYPE_SAY)
else
doCreatureSay(cid, '2', TALKTYPE_SAY)
end
 
Back
Top