OTClient Quest Log displays garbled text

Shadows

Kylaria Programmer
Joined
Jun 15, 2007
Messages
90
Reaction score
2
Location
Canada
Hello,

I have searched far and wide to find someone with the same issue but either I really suck at searching or it's unique to me.

My Quest Log in the OTClient on the first window displays garbled text instead of the Quest Name.

Example:

qlog1.png

However if I click on one of the quests it will display the mission names correctly.

Example 2:
qlog2.png

I've tried using other versions of the OTClient as well as pre-existing already compiled clients and they all do the same thing, I've tried other versions of the questlog module and they also all do the same thing, the one I'm using is pretty generic but I'll attach it anyway.


Lua:
questLogButton = nil
questLineWindow = nil

function init()
  g_ui.importStyle('questlogwindow')
  g_ui.importStyle('questlinewindow')

  questLogButton = modules.client_topmenu.addLeftGameButton('questLogButton', tr('Quest Log'), '/images/topbuttons/questlog', function() g_game.requestQuestLog() end)

  connect(g_game, { onQuestLog = onGameQuestLog,
                    onQuestLine = onGameQuestLine,
                    onGameEnd = destroyWindows})
end

function terminate()
  disconnect(g_game, { onQuestLog = onGameQuestLog,
                       onQuestLine = onGameQuestLine,
                       onGameEnd = destroyWindows})

  destroyWindows()
  questLogButton:destroy()
end

function destroyWindows()
  if questLogWindow then
    questLogWindow:destroy()
  end

  if questLineWindow then
    questLineWindow:destroy()
  end
end

function onGameQuestLog(quests)
  destroyWindows()

  questLogWindow = g_ui.createWidget('QuestLogWindow', rootWidget)
  local questList = questLogWindow:getChildById('questList')

  for i,questEntry in pairs(quests) do
    local id, name, completed = unpack(questEntry)

    local questLabel = g_ui.createWidget('QuestLabel', questList)
    questLabel:setOn(completed)
    questLabel:setText(name)
    questLabel.onDoubleClick = function()
      questLogWindow:hide()
      g_game.requestQuestLine(id)
    end
  end

  questLogWindow.onDestroy = function()
    questLogWindow = nil
  end

  questList:focusChild(questList:getFirstChild())
end

function onGameQuestLine(questId, questMissions)
  if questLogWindow then questLogWindow:hide() end
  if questLineWindow then questLineWindow:destroy() end

  questLineWindow = g_ui.createWidget('QuestLineWindow', rootWidget)
  local missionList = questLineWindow:getChildById('missionList')
  local missionDescription = questLineWindow:getChildById('missionDescription')

  connect(missionList, { onChildFocusChange = function(self, focusedChild)
    if focusedChild == nil then return end
    missionDescription:setText(focusedChild.description)
  end })

  for i,questMission in pairs(questMissions) do
    local name, description = unpack(questMission)

    local missionLabel = g_ui.createWidget('MissionLabel')
    missionLabel:setText(name)
    missionLabel.description = description
    missionList:addChild(missionLabel)
  end

  questLineWindow.onDestroy = function()
    if questLogWindow then questLogWindow:show() end
    questLineWindow = nil
  end

  missionList:focusChild(missionList:getFirstChild())
end

The line

Code:
questLabel:setText(name)

Appears to be where the issue is happening, if I change it to

Code:
questLabel:setText(id)

It displays the Quest ID without issue.

I have no idea what could be causing this or even where to start.

Any help would be greatly appreciated.
 
OP
Shadows

Shadows

Kylaria Programmer
Joined
Jun 15, 2007
Messages
90
Reaction score
2
Location
Canada
Bump, still trying to figure this out, I've even tried adding a whole new variable to the quests.xml file and calling that and it still displays the text the same, but still only for the initial quest on not the missions.
 

Night Wolf

I don't bite.
Joined
Feb 10, 2008
Messages
459
Solutions
6
Reaction score
686
try changing it to this:


local id, name, completed = "", "", ""
id, name, completed = unpack(questEntry)

It's just a guess but it may be due the variable not being unpacked in time that you're acessing position in memory that you shouldn't. Also try to convert your file to 'ANSII' if you're using special characteres
 
OP
Shadows

Shadows

Kylaria Programmer
Joined
Jun 15, 2007
Messages
90
Reaction score
2
Location
Canada
I really appreciate the reply,

Both changes lead to the same end result

I also tried what I think you meant and encoded it as ASCII and it still displays strangely like the above image.

I'm very confused as the quest missions work fine, just not the Quests themselves.
 
Last edited:

Shadow_

Veteran OT User
Joined
Jun 2, 2018
Messages
906
Solutions
29
Reaction score
335
I really appreciate the reply,

Both changes lead to the same end result

I also tried what I think you meant and encoded it as ASCII and it still displays strangely like the above image.

I'm very confused as the quest missions work fine, just not the Quests themselves.
might be something from quests.xml can you share it?
this is the original from otcv8 repo
Lua:
questLogButton = nil
questLineWindow = nil

function init()
  g_ui.importStyle('questlogwindow')
  g_ui.importStyle('questlinewindow')
 
  if not g_app.isMobile() then
    questLogButton = modules.client_topmenu.addLeftGameButton('questLogButton', tr('Quest Log'), '/images/topbuttons/questlog', function() g_game.requestQuestLog() end, false, 8)
  end
 
  connect(g_game, { onQuestLog = onGameQuestLog,
                    onQuestLine = onGameQuestLine,
                    onGameEnd = destroyWindows})
end

function terminate()
  disconnect(g_game, { onQuestLog = onGameQuestLog,
                       onQuestLine = onGameQuestLine,
                       onGameEnd = destroyWindows})

  destroyWindows()
  if questLogButton then
    questLogButton:destroy()
  end
end

function destroyWindows()
  if questLogWindow then
    questLogWindow:destroy()
  end

  if questLineWindow then
    questLineWindow:destroy()
  end
end

function onGameQuestLog(quests)
  destroyWindows()

  questLogWindow = g_ui.createWidget('QuestLogWindow', rootWidget)
  local questList = questLogWindow:getChildById('questList')

  for i,questEntry in pairs(quests) do
    local id, name, completed = unpack(questEntry)

    local questLabel = g_ui.createWidget('QuestLabel', questList)
    questLabel:setOn(completed)
    questLabel:setText(name)
    questLabel.onDoubleClick = function()
      questLogWindow:hide()
      g_game.requestQuestLine(id)
    end
  end

  questLogWindow.onDestroy = function()
    questLogWindow = nil
  end

  questList:focusChild(questList:getFirstChild())
end

function onGameQuestLine(questId, questMissions)
  if questLogWindow then questLogWindow:hide() end
  if questLineWindow then questLineWindow:destroy() end

  questLineWindow = g_ui.createWidget('QuestLineWindow', rootWidget)
  local missionList = questLineWindow:getChildById('missionList')
  local missionDescription = questLineWindow:getChildById('missionDescription')

  connect(missionList, { onChildFocusChange = function(self, focusedChild)
    if focusedChild == nil then return end
    missionDescription:setText(focusedChild.description)
  end })

  for i,questMission in pairs(questMissions) do
    local name, description = unpack(questMission)

    local missionLabel = g_ui.createWidget('MissionLabel')
    missionLabel:setText(name)
    missionLabel.description = description
    missionList:addChild(missionLabel)
  end

  questLineWindow.onDestroy = function()
    if questLogWindow then questLogWindow:show() end
    questLineWindow = nil
  end

  missionList:focusChild(missionList:getFirstChild())
end
might be there a diff
 
Last edited:
OP
Shadows

Shadows

Kylaria Programmer
Joined
Jun 15, 2007
Messages
90
Reaction score
2
Location
Canada
I like your name first of all haha.

I'm using the quests.xml file below to test.


XML:
<?xml version="1.0" encoding="UTF-8"?>
<quests>
    <quest name="Test Quest" startstorageid="90203" startstoragevalue="1">
        <mission name="Test Mission 1" storageid="90205" startvalue="1" endvalue="2">
            <missionstate id="1" description="Talk to Jimmy."/>
            <missionstate id="2" description="You talked to Jimmy!."/>
        </mission>
        <mission name="Test Mission 2" storageid="90206" startvalue="1" endvalue="2">
            <missionstate id="1" description="Open the chest beside Jimmy."/>
            <missionstate id="2" description="You opened the chest!"/>
        </mission>
    </quest>
</quests>

It's super simple as I was trying to see if it was something I did in the quests.xml file as well, but it happens with this one too.
 
Top