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

data/lib/004-database.lua:76: [Result:getDataString] Result not set!

dawnking

Member
Joined
Jun 23, 2016
Messages
176
Reaction score
22
I trying to use this system:
https://otland.net/threads/got-help-me-to-make-2-things.243854/page-3

But it's not work here...
When i look the flag to see wichs guild own the throne...
Show me this:
Code:
[22:2:11.244] [Error - CreatureScript Interface]
[22:2:11.244] data/creaturescripts/scripts/GOT/placas.lua:onLook
[22:2:11.244] Description:
[22:2:11.244] data/lib/004-database.lua:76: [Result:getDataString] Result not set!
[22:2:11.244] stack traceback:
[22:2:11.244]    [C]: in function 'error'
[22:2:11.244]    data/lib/004-database.lua:76: in function 'getDataString'
[22:2:11.244]    data/lib/guildlib.lua:96: in function 'getGuildName'
[22:2:11.244]    data/creaturescripts/scripts/GOT/placas.lua:16: in function <data/creaturescripts/scripts/GOT/placas.lua:14>

Code:
<event type="look" name="got_placas" event="script" value="GOT/placas.lua"/>

Code:
local guilds = {
    --[actionid] = número da cidade configurado em cityMonsters,
    [2391] = 1,
    [2392] = 2,
    [2393] = 3,
   [2394] = 4,
   [2395] = 5,
   [2396] = 6,
   [2397] = 7,
   [2398] = 8,
    [2399] = 9,
}

function onLook(cid, thing, position, lookDistance)
   if (thing.actionid == 3391) then
       local guildName = getGuildName(getGlobalStorageValue(guilds[2391] + DEFAULT_STORAGE))
       if guildName then
           doItemSetAttribute(thing.uid, "description", "First throne dominated by guild: " .. guildName .. " .")
       else
           doItemSetAttribute(thing.uid, "description", "First throne not dominated by any guild.")
       end
   elseif (thing.actionid == 3392) then
       local guildName = getGuildName(getGlobalStorageValue(guilds[2392] + DEFAULT_STORAGE))
       if guildName then
           doItemSetAttribute(thing.uid, "description", "Second throne dominated by guild: " .. guildName .. " .")
       else
           doItemSetAttribute(thing.uid, "description", "Second throne not dominated by any guild.")
       end
   elseif (thing.actionid == 3393) then
       local guildName = getGuildName(getGlobalStorageValue(guilds[2393] + DEFAULT_STORAGE))
       if guildName then
           doItemSetAttribute(thing.uid, "description", "Third throne dominated by guild: " .. guildName .. " .")
       else
           doItemSetAttribute(thing.uid, "description", "Third throne not dominated by any guild.")
       end
   elseif (thing.actionid == 3394) then
       local guildName = getGuildName(getGlobalStorageValue(guilds[2394] + DEFAULT_STORAGE))
       if guildName then
           doItemSetAttribute(thing.uid, "description", "Fourth throne dominated by guild: " .. guildName .. " .")
       else
           doItemSetAttribute(thing.uid, "description", "Fourth throne not dominated by any guild.")
       end
   elseif (thing.actionid == 3395) then
       local guildName = getGuildName(getGlobalStorageValue(guilds[2395] + DEFAULT_STORAGE))
       if guildName then
           doItemSetAttribute(thing.uid, "description", "Fiveth throne dominated by guild: " .. guildName .. " .")
       else
           doItemSetAttribute(thing.uid, "description", "Fiveth throne not dominated by any guild.")
       end
   elseif (thing.actionid == 3396) then
       local guildName = getGuildName(getGlobalStorageValue(guilds[2396] + DEFAULT_STORAGE))
       if guildName then
           doItemSetAttribute(thing.uid, "description", "Fifth throne dominated by guild: " .. guildName .. " .")
       else
           doItemSetAttribute(thing.uid, "description", "Fifth throne not dominated by any guild.")
       end
   elseif (thing.actionid == 3397) then
       local guildName = getGuildName(getGlobalStorageValue(guilds[2397] + DEFAULT_STORAGE))
       if guildName then
           doItemSetAttribute(thing.uid, "description", "Sixth throne dominated by guild: " .. guildName .. " .")
       else
           doItemSetAttribute(thing.uid, "description", "Sixth throne not dominated by any guild.")
       end
   elseif (thing.actionid == 3398) then
       local guildName = getGuildName(getGlobalStorageValue(guilds[2398] + DEFAULT_STORAGE))
       if guildName then
           doItemSetAttribute(thing.uid, "description", "Seventh throne dominated by guild: " .. guildName .. " .")
       else
           doItemSetAttribute(thing.uid, "description", "Seventh throne not dominated by any guild.")
       end
   elseif (thing.actionid == 3399) then
       local guildName = getGuildName(getGlobalStorageValue(guilds[2399] + DEFAULT_STORAGE))
       if guildName then
           doItemSetAttribute(thing.uid, "description", "Eighth throne dominated by guild: " .. guildName .. " .")
       else
           doItemSetAttribute(thing.uid, "description", "Eighth throne not dominated by any guild.")
       end
   end
   return true
end

004-database line 76
Code:
function Result:getDataString(s)
   if(self:getID() == -1) then
       error("[Result:getDataString] Result not set!")
   end

   return result.getDataString(self:getID(), s)
end

004-database full:
Code:
if(result == nil) then
   print("> WARNING: Couldn't load database lib.")
   return
end

Result = createClass(nil)
Result:setAttributes({
   id = -1,
   query = ""
})

function Result:getID()
   return self.id
end

function Result:setID(_id)
   self.id = _id
end

function Result:getQuery()
   return self.query
end

function Result:setQuery(_query)
   self.query = _query
end

function Result:create(_query)
   self:setQuery(_query)
   local _id = db.storeQuery(self:getQuery())
   if(_id) then
       self:setID(_id)
   end

   return self:getID()
end

function Result:getRows(free)
   local free = free or false
   if(self:getID() == -1) then
       error("[Result:getRows] Result not set!")
   end

   local c = 0
   repeat
       c = c + 1
   until not self:next()

   local _query = self:getQuery()
   self:free()
   if(not free) then
       self:create(_query)
   end

   return c
end

function Result:getDataInt(s)
   if(self:getID() == -1) then
       error("[Result:getDataInt] Result not set!")
   end

   return result.getDataInt(self:getID(), s)
end

function Result:getDataLong(s)
   if(self:getID() == -1) then
       error("[Result:getDataLong] Result not set!")
   end

   return result.getDataLong(self:getID(), s)
end

function Result:getDataString(s)
   if(self:getID() == -1) then
       error("[Result:getDataString] Result not set!")
   end

   return result.getDataString(self:getID(), s)
end

function Result:getDataStream(s)
   if(self:getID() == -1) then
       error("[Result:getDataStream] Result not set!")
   end

   return result.getDataStream(self:getID(), s)
end

function Result:next()
   if(self:getID() == -1) then
       error("[Result:next] Result not set!")
   end

   return result.next(self:getID())
end

function Result:free()
   if(self:getID() == -1) then
       error("[Result:free] Result not set!")
   end

   self:setQuery("")
   local ret = result.free(self:getID())
   self:setID(-1)
   return ret
end

Result.numRows = Result.getRows
function db.getResult(query)
   if(type(query) ~= 'string') then
       return nil
   end

   local ret = Result:new()
   ret:create(query)
   return ret
end
 
need to see getGuildName in your lib cause that's where the error is
edit:
this is easier
Code:
local t = {
    [3391] = {guild = 1, str = 'First'},
    [3392] = {guild = 2, str = 'Second'},
    [3393] = {guild = 3, str = 'Third'},
    [3394] = {guild = 4, str = 'Fourth'},
    [3395] = {guild = 5, str = 'Fifth'},
    [3396] = {guild = 6, str = 'Sixth'},
    [3397] = {guild = 7, str = 'Seventh'},
    [3398] = {guild = 8, str = 'Eighth'},
    [3399] = {guild = 9, str = 'Ninth'}
}

function onLook(cid, thing, position, lookDistance)
    local tmp = t[thing.actionid]
    if tmp then
        local guildName = getGuildName(getGlobalStorageValue(tmp.guild + DEFAULT_STORAGE))
        if getItemAttribute(thing.uid, 'description') == '' then
            if guildName then
                doItemSetAttribute(thing.uid, 'description', string.format('%s throne dominated by guild: %s .', tmp.str, guildName))
            else
                doItemSetAttribute(thing.uid, 'descrption', tmp.str .. 'throne not dominated by any guild.')
            end
        end
    end
   return true
end
 
Last edited:
need to see getGuildName in your lib cause that's where the error is
edit:
this is easier
Code:
local t = {
    [3391] = {guild = 1, str = 'First'},
    [3392] = {guild = 2, str = 'Second'},
    [3393] = {guild = 3, str = 'Third'},
    [3394] = {guild = 4, str = 'Fourth'},
    [3395] = {guild = 5, str = 'Fifth'},
    [3396] = {guild = 6, str = 'Sixth'},
    [3397] = {guild = 7, str = 'Seventh'},
    [3398] = {guild = 8, str = 'Eighth'},
    [3399] = {guild = 9, str = 'Ninth'}
}

function onLook(cid, thing, position, lookDistance)
    local tmp = t[thing.actionid]
    if tmp then
        local guildName = getGuildName(getGlobalStorageValue(tmp.guild + DEFAULT_STORAGE))
        if getItemAttribute(thing.uid, 'description') == '' then
            if guildName then
                doItemSetAttribute(thing.uid, 'description', string.format('%s throne dominated by guild: %s .', tmp.str, guildName))
            else
                doItemSetAttribute(thing.uid, 'descrption', tmp.str .. 'throne not dominated by any guild.')
            end
        end
    end
   return true
end

Thank you
But it's not work bro
I think i got this error because my guildlib.lua

Error
Code:
[13:18:12.376] [Error - CreatureScript Interface]
[13:18:12.376] data/creaturescripts/scripts/GOT/placas.lua:onLook
[13:18:12.376] Description:
[13:18:12.376] data/lib/004-database.lua:76: [Result:getDataString] Result not set!
[13:18:12.376] stack traceback:
[13:18:12.376]    [C]: in function 'error'
[13:18:12.376]    data/lib/004-database.lua:76: in function 'getDataString'
[13:18:12.376]    data/lib/guildlib.lua:96: in function 'getGuildName'
[13:18:12.376]    data/creaturescripts/scripts/GOT/placas.lua:16: in function <data/creaturescripts/scripts/GOT/placas.lua:13>

guildlib.lua
http://hastebin.com/oficekivuy.sql
 
Thank you
But it's not work bro
I think i got this error because my guildlib.lua

Error
Code:
[13:18:12.376] [Error - CreatureScript Interface]
[13:18:12.376] data/creaturescripts/scripts/GOT/placas.lua:onLook
[13:18:12.376] Description:
[13:18:12.376] data/lib/004-database.lua:76: [Result:getDataString] Result not set!
[13:18:12.376] stack traceback:
[13:18:12.376]    [C]: in function 'error'
[13:18:12.376]    data/lib/004-database.lua:76: in function 'getDataString'
[13:18:12.376]    data/lib/guildlib.lua:96: in function 'getGuildName'
[13:18:12.376]    data/creaturescripts/scripts/GOT/placas.lua:16: in function <data/creaturescripts/scripts/GOT/placas.lua:13>

guildlib.lua
http://hastebin.com/oficekivuy.sql
Code:
function getGuildName(guild_id)
   local result = db.getResult("SELECT `name` FROM `guilds` WHERE `id` = '".. guild_id .."';")
    local ret = (result:getID() == -1) and false or result:getDataString("name")
    result:free()
    return ret
end
try this?
 
Code:
function getGuildName(guild_id)
   local result = db.getResult("SELECT `name` FROM `guilds` WHERE `id` = '".. guild_id .."';")
    local ret = (result:getID() == -1) and false or result:getDataString("name")
    result:free()
    return ret
end
try this?

Code:
[18:3:21.011] [Error - CreatureScript Interface]
[18:3:21.011] data/creaturescripts/scripts/GOT/placas.lua:onLook
[18:3:21.011] Description:
[18:3:21.011] data/lib/004-database.lua:76: [Result:getDataString] Result not set!
[18:3:21.011] stack traceback:
[18:3:21.011]    [C]: in function 'error'
[18:3:21.011]    data/lib/004-database.lua:76: in function 'getDataString'
[18:3:21.011]    data/lib/guildlib.lua:96: in function 'getGuildName'
[18:3:21.011]    data/creaturescripts/scripts/GOT/placas.lua:16: in function <data/creaturescripts/scripts/GOT/placas.lua:13>
 
try just GetString
???????????????
doesn't exist lol

Code:
[18:3:21.011] [Error - CreatureScript Interface]
[18:3:21.011] data/creaturescripts/scripts/GOT/placas.lua:onLook
[18:3:21.011] Description:
[18:3:21.011] data/lib/004-database.lua:76: [Result:getDataString] Result not set!
[18:3:21.011] stack traceback:
[18:3:21.011]    [C]: in function 'error'
[18:3:21.011]    data/lib/004-database.lua:76: in function 'getDataString'
[18:3:21.011]    data/lib/guildlib.lua:96: in function 'getGuildName'
[18:3:21.011]    data/creaturescripts/scripts/GOT/placas.lua:16: in function <data/creaturescripts/scripts/GOT/placas.lua:13>
im out of ideas then
never used these db functions cause never found a use for them
knowledge is limited =/
 
try just GetString

Code:
[18:31:03.772] [Error - CreatureScript Interface]
[18:31:03.772] data/creaturescripts/scripts/GOT/placas.lua:onLook
[18:31:03.772] Description:
[18:31:03.772] data/lib/guildlib.lua:96: attempt to call method 'GetString' (a nil value)
[18:31:03.772] stack traceback:
[18:31:03.772]    data/lib/guildlib.lua:96: in function 'getGuildName'
[18:31:03.772]    data/creaturescripts/scripts/GOT/placas.lua:16: in function <data/creaturescripts/scripts/GOT/placas.lua:13>

???????????????
doesn't exist lol


im out of ideas then
never used these db functions cause never found a use for them
knowledge is limited =/


No problem! Ty you so much to try to help me :)
 
Back
Top