TalkAction Debug LUA scripts with talkaction!

PhoOwned

^_^
Joined
Nov 11, 2010
Messages
375
Best answers
0
Reaction score
65
Credits to Cykotitan

When you make script and it doesn't work you need to check what is wrong (storages,names,uids). I asked Cykotitan about help and he sent me this talkaction. VERY USEFUL!

talkactions.xml
PHP:
<talkaction log="yes" words="!lua" access="5" event="script" value="executelua.lua"/>
executelua.lua
PHP:
function onSay(cid, words, param, channel)
	function fuck(...)
		local t = {}
		for i = 2, arg.n do
			local v = tostring(arg[i])
			if v:len() > 0 then
				table.insert(t, v)
			end
		end
		if #t > 0 then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, table.concat(t, ', '))
		end
	end
	fuck(pcall(loadstring('local cid = ' .. cid .. ' ' .. param)))
	return true
end
How to use:
PHP:
!lua return getCreatureStorage(getCreatureByName("Burt Simpson"), 15000)
Show in 'Server Log' value of storage ID 15000 of player 'Burt Simpson" (only when he is online).
PHP:
!lua return getTopCreature({x=1,y=1,z=1}).uid
Show in 'Server Log' 0 - if no creature on tile or UID of top creature (value > 0)
You can write longer scripts ^_^
---------------
Tested on TFS 0.4, should work on 0.3.6pl1.
 

Elexonic

Well-Known Member
Joined
Jun 18, 2008
Messages
1,921
Best answers
0
Reaction score
56
o_O I tested last o.o

Rare xD
 
OP
P

PhoOwned

^_^
Joined
Nov 11, 2010
Messages
375
Best answers
0
Reaction score
65
If players want monsters (0.3.6):
PHP:
!lua function spawner(u,m,c,d)  if(isPlayer(u) and c > 0) then  c=c-1   doCreateMonster(m, getThingPosition(u))   addEvent(spawner, d, u, m, c, d)  end   end  spawner(getCreatureByName("player name"), "monster name here", 15, 1000)
in place of 15 put number of monsters, 1000 = monster spawn interval

EDIT:
I made some other function usefull for my ots :)
spawn monster on player, spawn monster on position, heal bot?, mana bot?, 'auto say' (talk type is now 19 - say like monster)
PHP:
!lua function spawnFol(u,m,c,d) if isPlayer(u) and c > 0 then c=c-1 doCreateMonster(m, getThingPosition(u)) addEvent(spawnFol,d,u,m,c,d)  end   end  spawnFol(getCreatureByName("[HOSTER] PhoOwned"),"Troll",1, 1000)

!lua function spawnPos(m,p,c,d) if c > 0 then c=c-1 doCreateMonster(m,p) addEvent(spawnPos,d,m,p,c,d) end end spawnPos("Troll",{x=,y=,z=},1,1000)

!lua function healer(u,v,c,d) if isPlayer(u) and c > 0 then c=c-1 doCreatureAddHealth(u, v) addEvent(healer,d,u,v,c,d)  end   end  healer(getCreatureByName("[HOSTER] PhoOwned"), 10, 1, 1000)

!lua function maner(u,v,c,d) if isPlayer(u) and c > 0 then  c=c-1 doCreatureAddMana(u, v)   addEvent(maner, d, u, v, c, d)  end   end  maner(getCreatureByName("[HOSTER] PhoOwned"), 10, 1, 1000)

!lua function talkSelf(u,t,s,c,d) if isPlayer(u) and c > 0 then c=c-1 doCreatureSay(u,t,s) addEvent(talkSelf,d,u,t,s,c,d) end end talkSelf(getCreatureByName("[HOSTER] PhoOwned"),"text",19,1,1000)
EDIT2:
Tommorow I'll post raid function :D
 
Last edited:
Top