PSOBB Addon Plugin (Lua UI addons)

I am not sure if ill be able to figure that out maybe @Ender has an idea I think the way my current name coloring works doesnt allow for that.
Nah no idea. Looks like this is how imgui just renders text when it starts at a specific X pos. The highlighted lines are a single text call so it wraps back to the beginning.

You would probably have to add something new to the base plugin to get around this that specifies the cursor's X position for lines after the wrap.

Maybe there's a way to calculate the text extent and split it into two strings--one for the first part and then a new line that starts with X pos == 0 for the wrapped text call. But I don't know if Imgui provides the text extent somewhere and the font size isn't really the width of the text.
 
I am not sure if ill be able to figure that out maybe @Ender has an idea I think the way my current name coloring works doesnt allow for that.

Also after enders PR ill prob add a setting so players can choose their highlight color.
I've figured out how to get the text to wrap the way I want it to but I don't use github. I also wouldn't say that its a good solution.
local namePadding = ""
while imgui.CalcTextSize(namePadding) < imgui.CalcTextSize(nameFormat)-imgui.CalcTextSize(" ") do
namePadding = namePadding .. " "
end
imgui.SetCursorPos(imgui.GetCursorPosX()-imgui.CalcTextSize(namePadding), imgui.GetCursorPosY())
imgui.TextWrapped(namePadding .. options.clMessageSeparator .. formattedText)
The idea is to start the text portion of the message at the same place as the name starts so the line wrap starts at the far left and just add spaces to the beginning so that the messages text doesn't overlap the name.
One issue is that a bunch of spaces won't always line up nicely with the end of the name to place the separator so I've dynamically moved the starting position so that the separator does line up but the wrapped text might be a tiny bit indented. I couldn't figure out a way to get both to line up every time so I had to pick one.
 
I've found another issue. It appears that if you've used /modname on a character it won't highlight anymore.
you sure it isnt due to character name length? It looks like Enders code only allowed up to named 7 characters long the issue was
return read_pso_str(player + CHARACTERNAME_OFFSET, 20)
each letter of a characters name is 2 bytes so 20 would in theory work but the issue is there are some characters prior to the character name which we skip but still use part of that 20, I increased it to 24 and it seems to read them all now. (10 letter max)

I just pushed a fix for that as well as a few other things, Let me know more into on your word wrap and I can make it into a toggle setting.
433053974-d8a8045d-ab3b-41b3-af7e-5634acb46129.png
 
you sure it isnt due to character name length? It looks like Enders code only allowed up to named 7 characters long the issue was
return read_pso_str(player + CHARACTERNAME_OFFSET, 20)
each letter of a characters name is 2 bytes so 20 would in theory work but the issue is there are some characters prior to the character name which we skip but still use part of that 20, I increased it to 24 and it seems to read them all now. (10 letter max)

I just pushed a fix for that as well as a few other things, Let me know more into on your word wrap and I can make it into a toggle setting.
View attachment 24129
Still doesn't seem to fix it
YlnNiBe.png
 
  • Like
Reactions: Esc
Back
Top