[ADDON] RoR State of Realm v1.2.4 UPDATED!

Here you can post addons, or anything related to addons.
Forum rules
Before posting on this forum, be sure to read the Terms of Use
User avatar
Omegus
Posts: 1365

Re: [ADDON] RoR State of Realm v1.2.4 UPDATED!

Post#271 » Wed Jun 01, 2022 11:45 am

Testing on https://www.lua.org/cgi-bin/demo which doesn't have wstring support (that's a LuaPlus thing):

Code: Select all

local function title_case_helper(first, rest)
  return first:upper()..rest:lower()
end

function title_case(text)
    -- gsub returns multiple values, we just want the first.
    local result = string.gsub(text, "(%a)([%w_']*)", title_case_helper)
    return result
end

print (title_case("foo"))
print (title_case("foo bar"))
Prints out:

Code: Select all

Foo
Foo Bar
I assume the wstring version is just:

Code: Select all

local function title_case_helper(first, rest)
  return first:upper()..rest:lower()
end

function title_case(text)
    -- gsub returns multiple values, we just want the first.
    local result = wstring.gsub(text, L"(%a)([%w_']*)", title_case_helper)
    return result
end
So if that first wstring.gsub returns nil then call "ShortGName = title_case (ShortGName)", and then try to shorten the name again.

100% untested in the context of the SoR addon.
Zomega: RR8x Zealot

Ads
User avatar
b00n
Posts: 192

Re: [ADDON] RoR State of Realm v1.2.4 UPDATED!

Post#272 » Wed Jun 01, 2022 12:23 pm

Omegus wrote: Wed Jun 01, 2022 11:45 am Testing on https://www.lua.org/cgi-bin/demo which doesn't have wstring support (that's a LuaPlus thing):

Code: Select all

local function title_case_helper(first, rest)
  return first:upper()..rest:lower()
end

function title_case(text)
    -- gsub returns multiple values, we just want the first.
    local result = string.gsub(text, "(%a)([%w_']*)", title_case_helper)
    return result
end

print (title_case("foo"))
print (title_case("foo bar"))
Prints out:

Code: Select all

Foo
Foo Bar
I assume the wstring version is just:

Code: Select all

local function title_case_helper(first, rest)
  return first:upper()..rest:lower()
end

function title_case(text)
    -- gsub returns multiple values, we just want the first.
    local result = wstring.gsub(text, L"(%a)([%w_']*)", title_case_helper)
    return result
end
So if that first wstring.gsub returns nil then call "ShortGName = title_case (ShortGName)", and then try to shorten the name again.

100% untested in the context of the SoR addon.

Hey, thanks for the reply. I gave it a quick shot and i think it is still not correct, here the full code of the SOR addon (replaced all wstring with string, as you mentioned wstring is some sort of extension):

Code: Select all

local function title_case_helper(first, rest)
  return first:upper()..rest:lower()
end

function title_case(text)
    -- gsub returns multiple values, we just want the first.
    local result = string.gsub(text, "(%a)([%w_']*)", title_case_helper)
    return result
end

local ShortGName = "foo bar"
ShortGName = string.gsub(ShortGName, " of ", "O")
ShortGName = string.gsub(ShortGName, "%s", "")
local ShortGName2 = string.gsub(ShortGName, "%l*", "")
if ShortGName2 ~= nil then
 ShortGName = title_case(ShortGName)
end
ShortGName = string.match(ShortGName, "([^^]+)^?.*")

print (ShortGName)
update: https://pastebin.com/6ds8DdUC used your method on the initial KeepClaim Text and now it produces something.

example: https://imgur.com/a/TRRwv1W
Destro: Chosen 85+, Zealot 80+, Sorceress 80+, Dok 80+, BG 80+, Magus 80+, Choppa 80+, WitchElf 80+
Order: SM 64, Warrior Priest 47, AM, BrightWizard, ShadowWarrior, Kotbs

User avatar
Omegus
Posts: 1365

Re: [ADDON] RoR State of Realm v1.2.4 UPDATED!

Post#273 » Wed Jun 01, 2022 3:29 pm

In your code:

Code: Select all

local ShortGName2 = wstring.gsub(ShortGName, L"%l*", L"")
if ShortGName2 == nil then
  ShortGName = ShortGName2
end
Should this be checking if ShortGName2 is NOT nil? Otherwise if it's nil it'll just propagate the nil into the rest of the code. If it's not nil then we want to copy it into ShortGName for the rest of the checks.
Zomega: RR8x Zealot

User avatar
b00n
Posts: 192

Re: [ADDON] RoR State of Realm v1.2.4 UPDATED!

Post#274 » Wed Jun 01, 2022 6:41 pm

Omegus wrote: Wed Jun 01, 2022 3:29 pm In your code:

Code: Select all

local ShortGName2 = wstring.gsub(ShortGName, L"%l*", L"")
if ShortGName2 == nil then
  ShortGName = ShortGName2
end
Should this be checking if ShortGName2 is NOT nil? Otherwise if it's nil it'll just propagate the nil into the rest of the code. If it's not nil then we want to copy it into ShortGName for the rest of the checks.
oh yeah you are right. i think it's redundant code. will test without it and let you know
Destro: Chosen 85+, Zealot 80+, Sorceress 80+, Dok 80+, BG 80+, Magus 80+, Choppa 80+, WitchElf 80+
Order: SM 64, Warrior Priest 47, AM, BrightWizard, ShadowWarrior, Kotbs

User avatar
b00n
Posts: 192

Re: [ADDON] RoR State of Realm v1.2.4 UPDATED!

Post#275 » Thu Jun 02, 2022 9:46 am

pushed a new version (1.2.5 ) to https://tools.idrinth.de/addons/ror_sor/download/1-2-5/ .

changelog:
- Fixed that guilds with lower case names break the display

codechange:
Added local ShortGName = towstring(title_case(KEEP1_CLAIM))
Added local ShortGName = towstring(title_case(KEEP2_CLAIM))

where title_case is the suggested function from Omegus.
Destro: Chosen 85+, Zealot 80+, Sorceress 80+, Dok 80+, BG 80+, Magus 80+, Choppa 80+, WitchElf 80+
Order: SM 64, Warrior Priest 47, AM, BrightWizard, ShadowWarrior, Kotbs

User avatar
normanis
Posts: 1302
Contact:

Re: [ADDON] RoR State of Realm v1.2.4 UPDATED!

Post#276 » Thu Jun 02, 2022 10:01 am

will there be lotd pairing also showed in this addon?
"Iron Within, Iron Without!"

User avatar
b00n
Posts: 192

Re: [ADDON] RoR State of Realm v1.2.4 UPDATED!

Post#277 » Thu Jun 02, 2022 10:04 am

normanis wrote: Thu Jun 02, 2022 10:01 am will there be lotd pairing also showed in this addon?
the information given to this addon are provided via the Channel 9, currently i think there is no information provided in that string. This is something the ROR-team has to provide and then the addon could be extended to show this information.
Destro: Chosen 85+, Zealot 80+, Sorceress 80+, Dok 80+, BG 80+, Magus 80+, Choppa 80+, WitchElf 80+
Order: SM 64, Warrior Priest 47, AM, BrightWizard, ShadowWarrior, Kotbs

User avatar
normanis
Posts: 1302
Contact:

Re: [ADDON] RoR State of Realm v1.2.4 UPDATED!

Post#278 » Fri Jun 03, 2022 1:19 pm

b00n wrote: Thu Jun 02, 2022 10:04 am
normanis wrote: Thu Jun 02, 2022 10:01 am will there be lotd pairing also showed in this addon?
the information given to this addon are provided via the Channel 9, currently i think there is no information provided in that string. This is something the ROR-team has to provide and then the addon could be extended to show this information.
ok thx for answer
"Iron Within, Iron Without!"

Ads
Mrandregoe1982
Posts: 1

Not woeking in latest cersion of ROR T1

Post#279 » Tue Aug 30, 2022 8:20 pm

Addon does not work in T1 ORvR only shows when zone at 100%

User avatar
Dana
Former Staff
Posts: 2300

Re: [ADDON] RoR State of Realm v1.2.4 UPDATED!

Post#280 » Fri Feb 24, 2023 2:25 pm

Hey Sullemunk :) sadly it does still not work for T1! Could you take a look at it?
"A danger foreseen is a danger avoided."

Dana - WE
Horsegirl - DoK

Who is online

Users browsing this forum: No registered users and 7 guests