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

TalkAction A better way to report bugs

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,858
Reaction score
96
Location
Brazil
After a request made ​​by me, Bogart helped me here: http://otland.net/f132/talkaction-bug-report-147010/#post1414381
Credits to him, not to me.

How it works
When player report a bug it will be saved in "data/logs/bugs.txt". 120 seconds(2min) of delay added to prevent spammers.

in talkactions.xml add
XML:
	<talkaction words="!bugreport;/bugreport" event="script" value="bugreport.lua"/>

create .lua file and rename to "bugreport.lua".
Lua:
function onSay(cid, words, param, channel)
local storage = 6707
local delaytime = 120
local a = "data/logs/bugs.txt"
local f = io.open(a, "a+")
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return true
	end
local exhaust = exhaustion.get(cid, storage)
	if(not exhaust) then
		exhaustion.set(cid, storage, delaytime)
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your report has been received successfully!")
		f:write(""..getPlayerName(cid).." reported a bug at " .. os.date("%d %B %Y - %X.", os.time()) .."\n"..param.." [x="..getPlayerPosition(cid).x..", y="..getPlayerPosition(cid).y..", z="..getPlayerPosition(cid).z.."].\n\n----------------------------------------------------------\n")
		f:close()
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You must wait " .. exhaustion.get(cid, storage) .. " seconds to report.")
	end
return TRUE
end

How to use
Code:
!bugreport, [I][COLOR="#FF0000"]your comment[/COLOR][/I]

Example
Code:
Druid reported a bug at 21 December 2011 - 20:24:42 
There is a bug in Carlin Wall. [x=32360, y=31782, z=7].

----------------------------------------------------------
Sorcerer reported a bug at 21 December 2011 - 20:28:01 
Help me i cant move. [x=11457, y=45789, z=5].

----------------------------------------------------------
 
Last edited:
After a request made ​​by me, Bogart helped me here: http://otland.net/f132/talkaction-bug-report-147010/#post1414381
Credits to him, not to me.

How it works
When player report a bug it will be saved in "data/logs/bugs.txt". 120 seconds(2min) of delay added to prevent spammers.

in talkactions.xml add
XML:
	<talkaction words="!bugreport;/bugreport" event="script" value="bugreport.lua"/>

create .lua file and rename to "bugreport.lua".
Lua:
function onSay(cid, words, param, channel)
local storage = 6707
local delaytime = 120
local a = "data/logs/bugs.txt"
local f = io.open(a, "a+")
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return true
	end
local exhaust = exhaustion.get(cid, storage)
	if(not exhaust) then
		exhaustion.set(cid, storage, delaytime)
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your report has been received successfully!")
		f:write(""..getPlayerName(cid).." reported a bug at " .. os.date("%d %B %Y - %X.", os.time()) .."\n"..param.." [x="..getPlayerPosition(cid).x..", y="..getPlayerPosition(cid).y..", z="..getPlayerPosition(cid).z.."].\n\n----------------------------------------------------------\n")
		f:close()
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You must wait " .. exhaustion.get(cid, storage) .. " seconds to report.")
	end
return TRUE
end

How to use
Code:
!bugreport, [I][COLOR="#FF0000"]your comment[/COLOR][/I]

Example
Code:
Druid reported a bug at 21 December 2011 - 20:24:42 
There is a bug in Carlin Wall. [x=32360, y=31782, z=7].

----------------------------------------------------------
Sorcerer reported a bug at 21 December 2011 - 20:28:01 
Help me i cant move. [x=11457, y=45789, z=5].

----------------------------------------------------------

Hello,

Its a nice release!
But it doesnt work for rev 3858 (0.4)
The 'command param required' gets showed when u only say !bugreport.
But when u try to do !bugreport, <text>.
Than nothing happends :(
 
try with:
!bugreport Text

for example:
!bugreport Somethink doesn't work in temple.
 
I did the same script for my server! With the same delay xd!

The only difference is that i make it to save bugs in a .xml file, for a easier reading using a command (/bugs -> and show all bugs reported with function doShowTextDialog, /bugs Playername -> Show all bugs reported by a player)

PD: It's a nice and useful script.
 
Why is this better than Ctrl+Z, a built-in window (one of very few)?
Also, you can make ctrl+z reports to be saved in the file directly too, lol ._.
 
I am sorry for refreshing but when I use that script, an error pops up in my console :(
here is it:
error1.jpg

and also,
@elf,
ctrl + z doesnt work with my ot ;o why? it says that u r not authorized to send bugs raports


EDIT:
I have already seen few people that are really good in lua etc and they didn't reply here with help. Oh well...
 
Last edited:
Old thread i know, but any chance to make this for TFS 1.2?

Use it, tooked 5 minutes.

Code:
local config = {
    storage = 6707,
    cooldown = 120,
    file = "data/logs/bugs.log"
}

function onSay(player, words, param)
    local file = io.open(config.file, "a")
    if not file then
        print(string.format("Warning: Could not open %s", config.file))
        return true
    end

    local split = param:split(",")
    local action = split[1]
  
    if (action == nil) then
        return true
    end
  
    if player:getStorageValue(config.storage) >= os.time() then
        player:sendTextMessage(MESSAGE_INFO_DESCR, string.format('You must wait %d seconds to use this command again', config.cooldown))
        return false
    end
  
    io.output(file)
    io.write("------------------------------\n")
    local position = player:getPosition()
    player:sendTextMessage(MESSAGE_INFO_DESCR, string.format('[%s] - Player %s reported a bug at %d, %d, %d with description: %s.', os.date("%c"), player:getName(), position.x, position.y, position.z, param))
    player:setStorageValue(config.storage, os.time() + config.cooldown)
    player:sendCancelMessage("Your report has been received successfully!")
    return false
end
 
Last edited:
Use it, tooked 5 minutes.

Code:
local config = {
    storage = 6707,
    cooldown = 120,
    file = "data/logs/bugs.log"
}

function onSay(player, words, param)
    local file = io.open(config.file, "a")
    if not file then
        print(string.format("Warning: Could not open %s", config.file))
        return true
    end

    local split = param:split(",")
    local action = split[1]
  
    if (action == nil) then
        return true
    end
  
    if player:getStorageValue(config.storage) >= os.time() then
        player:sendTextMessage(MESSAGE_INFO_DESCR, string.format('You must wait %d seconds to use this command again', config.cooldown))
        return false
    end
  
    io.output(file)
    io.write("------------------------------\n")
    local position = player:getPosition()
    player:sendTextMessage(MESSAGE_INFO_DESCR, string.format('[%s] - Player %s reported a bug at %d, %d, %d', os.date("%c"), player:getName(), position.x, position.y, position.z))
    player:sendCancelMessage("Your report has been received successfully!")
    return false
end
you didnt defined exhaustion but u are checking it
 
Back
Top