szef Posted October 21, 2022 Author Share Posted October 21, 2022 (edited) @lefreut I'd really wish to know more about Lua, I've been messing with this code in 1000 ways (trial and error)... Is it supposed to be, let's assume, in the same function as process above (in previous code)? Edited October 21, 2022 by szef Quote Link to comment
lefreut Posted October 21, 2022 Share Posted October 21, 2022 9 minutes ago, szef said: @lefreut I'd really wish to know more about Lua, I've been messing with this code in 1000 ways (trial and error)... Is it supposed to be, let's assume, in the same function as process above (in previous code)? What changes are you trying to make? Quote Link to comment
szef Posted October 21, 2022 Author Share Posted October 21, 2022 (edited) @lefreut I'am trying to changing this color ^0xff7da58c (i assume most of the dialog texts) for let's say #DADADA. And other colors. I need piece of code, or answer how it may look like, or where to find/learn about ;). (In websearch... yes yes i know - searching for 4h) To be more specific, few questions is mayby, this new post-process has to be in the same function as in the code below? function getDialogEntryText(row) local text = dialogTable[row].text if (row == worldPlayerDialogSelection) then --Color the text white when selected text = string.gsub(text, "%^0xff212eff", "^0xFFFFFFFF") end return text end Something must be instead worldPlayerDialogSelection ... i'am clueless. Oh, well :D. Edited October 21, 2022 by szef Quote Link to comment
lefreut Posted October 21, 2022 Share Posted October 21, 2022 The easiest is probably to add the change in this function yes. string.gsub is used to replace a substring by another one. The first argument is the string, the second the pattern and the third the replacement. For example, this to change all occurrences of '^0xff7da58c' (you have to escape the ^ with a % as otherwise it has a special meaning in regex) into '^0xFFC0CBFF': text = string.gsub(text, "%^0xff7da58c", "^0xFFC0CBFF") or this to replace all colors (^0x followed by 8 hex character) with '^0xFFC0CBFF': text = string.gsub(text, "%^0x%x%x%x%x%x%x%x%x", "^0xFFC0CBFF") Quote Link to comment
szef Posted October 21, 2022 Author Share Posted October 21, 2022 Okay, thanks, something's starting clearing up for me (i think). But what about worldPlayerDialogSelection because this is for... select the choises lines (?). What, I need enter for "text in the dialogue" - speaking the easiest. Do you know this? (Tomorrow will be next round of trying ). Quote Link to comment
lefreut Posted October 21, 2022 Share Posted October 21, 2022 If you want to target only the dialog lines and not the list of answers, you can do this: if (not getDialogRowClickable(row)) then text = string.gsub(text, "%^0x%x%x%x%x%x%x%x%x", "^0xFFC0CBFF") end Quote Link to comment
szef Posted October 21, 2022 Author Share Posted October 21, 2022 Ok, it works ;). I need two 'parameters' (for now) more: the list of answers (the red ones), and for the numbers of this answers, i.e. 1. Answer. 2. Answer. Quote Link to comment
szef Posted October 22, 2022 Author Share Posted October 22, 2022 (edited) It is done. Full code: function getDialogEntryText(row) local text = dialogTable[row].text if (not getDialogRowClickable(row)) then --Change color font for Characters name text = string.gsub(text, "%^0xff75a1b8", "^0xFF81c6d9") end if (not getDialogRowClickable(row)) then --For dialogue lines text = string.gsub(text, "%^0xff7da58c", "^0xFFcad3d2") end if (not getDialogHistory) then --For TNO name text = string.gsub(text, "%^0xffd5c885", "^0xFF5d6966") end if (not getDialogHistory) then --For the lines said by TNO text = string.gsub(text, "%^0xffd7c8a0", "^0xFF5d6966") end if (not getDialogResponses) then --For 1. 2. etc. text = string.gsub(text, "%^0xffcec471", "^0xFF111dd8") end if (not getDialogClickable) then --For list of answers text = string.gsub(text, "%^0xff212eff", "^0xFF111dd8") end if (row == worldPlayerDialogSelection) then --For text when selected text = string.gsub(text, "%^0xFF111dd8", "^0xFFacacad") end return text end Thank you lefreut for your help!! Edited March 19, 2023 by szef Quote Link to comment
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.