ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   String Manipulation help (https://www.esoui.com/forums/showthread.php?t=2056)

SkOODaT 08/04/14 02:31 PM

String Manipulation help
 
need a bit of help with these "guild traders" as soon as a guild reserves it changes the caption to "guild trader (GUILDNAME)"

My vendors addon plots the npcs by Add("PIN_GUILDTRADER", "Guild Trader")

Is thier a way for me to have the sting post what ever it finds i thought it was something like

Add("PIN_GUILDTRADER", "Guild Trader%s")

thank you

Garkin 08/04/14 03:08 PM

You probably want to do something like this:

Lua Code:
  1. local Add = ZO_CreateStringId
  2. Add("PIN_GUILDTRADER", "Guild Trader (<<1>>)")
  3.  
  4. zo_strformat(PIN_GUILDTRADER, guildName)

SkOODaT 08/04/14 05:25 PM

Quote:

Originally Posted by Garkin (Post 11134)
You probably want to do something like this:

Lua Code:
  1. local Add = ZO_CreateStringId
  2. Add("PIN_GUILDTRADER", "Guild Trader (<<1>>)")
  3.  
  4. zo_strformat(PIN_GUILDTRADER, guildName)

ty cant get it to work like that tho ..is thier anyway for me have it just ignore anyhting past "guild trader"... can always explore guild options later

Garkin 08/04/14 05:50 PM

Can you post a code snippet so I have an idea what are you trying to do?


If I understand correctly, you want to display "Guild Trader" and then later update it to "Guild Trader (Guild Name)".

So you can either make two different strings:
Lua Code:
  1. ZO_CreateStringId("PIN_GUILDTRADER_NONAME", "Guild Trader")
  2. ZO_CreateStringId("PIN_GUILDTRADER_GUILDNAME", "Guild Trader (<<1>>)")
  3.      
  4. local text = guildname ~= nil and zo_strformat(PIN_GUILDTRADER_GUILDNAME, guildName) or GetString(PIN_GUILDTRADER_NONAME)

Or just concatenate strings:
Lua Code:
  1. ZO_CreateStringId("PIN_GUILDTRADER", "Guild Trader")
  2.      
  3. local text = GetString(PIN_GUILDTRADER) .. (guildName ~= nil and guildname or "")

SkOODaT 08/04/14 07:14 PM

im trying to load pins on to the map from my database the problem is "Guild Trader" will get pinned because its a static name where in "Guild Trader (GUILDNAME)" i cant pin because its being loged under a guild name.. if i could just get it to load all of them with "Guild Trader" regardless of the guild text work the best

Lua Code:
  1. local Add = ZO_CreateStringId
  2.   -- GUILD VENDORS    
  3.     Add("PIN_GUILDTRADER", "Guild Trader")

Lua Code:
  1. local Pins = VendorSavedAccount.Data[Zone .. "/" .. Subzone]
  2. for _, PinData in ipairs(Pins) do
  3.         -- GUILD VENDORS
  4.         if VendorSaved.GuildTrader and PinData[2] == GetString(PIN_GUILDTRADER) then
  5.             LMP:CreatePin(PinType1, PinData, PinData[4], PinData[5])
  6. end
  7. end

the database tho is logging like this .....

Lua Code:
  1. [21] =
  2.                         {
  3.                             [1] = "Endoriell",
  4.                             [2] = "Guild Trader (Torment)",
  5.                             [3] = "Mournhold",
  6.                             [4] = 0.588913,
  7.                             [5] = 0.772125,
  8.                         },
  9.                         [22] =
  10.                         {
  11.                             [1] = "Gals Fendyn",
  12.                             [2] = "Guild Trader",
  13.                             [3] = "Mournhold",
  14.                             [4] = 0.586682,
  15.                             [5] = 0.743874,
  16.                         },
  17.                         [23] =
  18.                         {
  19.                             [1] = "Razgugul",
  20.                             [2] = "Guild Trader",
  21.                             [3] = "Mournhold",
  22.                             [4] = 0.595029,
  23.                             [5] = 0.783571,
  24.                         },
  25.                         [24] =
  26.                         {
  27.                             [1] = "Hayaia",
  28.                             [2] = "Guild Trader (Valor)",
  29.                             [3] = "Mournhold",
  30.                             [4] = 0.627713,
  31.                             [5] = 0.775870,
  32.                         },
  33.                         [25] =
  34.                         {
  35.                             [1] = "Through-Gilded-Eyes",
  36.                             [2] = "Guild Trader",
  37.                             [3] = "Mournhold",
  38.                             [4] = 0.633267,
  39.                             [5] = 0.734742,
  40.                         },
  41.                         [26] =
  42.                         {
  43.                             [1] = "Erwurlde",
  44.                             [2] = "Guild Trader",
  45.                             [3] = "Mournhold",
  46.                             [4] = 0.624318,
  47.                             [5] = 0.734251,
  48.                         },
  49.                         [27] =
  50.                         {
  51.                             [1] = "Zarum",
  52.                             [2] = "Guild Trader",
  53.                             [3] = "Mournhold",
  54.                             [4] = 0.579066,
  55.                             [5] = 0.742681,
  56.                         },

trying to get them all to pin

Garkin 08/04/14 07:46 PM

Quote:

Originally Posted by SkOODaT (Post 11144)
im trying to load pins on to the map from my database the problem is "Guild Trader" will get pinned because its a static name where in "Guild Trader (GUILDNAME)" i cant pin because its being loged under a guild name.. if i could just get it to load all of them with "Guild Trader" regardless of the guild text work the best

Lua Code:
  1. local Add = ZO_CreateStringId
  2.   -- GUILD VENDORS    
  3.     Add("PIN_GUILDTRADER", "Guild Trader")

Lua Code:
  1. local Pins = VendorSavedAccount.Data[Zone .. "/" .. Subzone]
  2. for _, PinData in ipairs(Pins) do
  3.         -- GUILD VENDORS
  4.         if VendorSaved.GuildTrader and PinData[2] == GetString(PIN_GUILDTRADER) then
  5.             LMP:CreatePin(PinType1, PinData, PinData[4], PinData[5])
  6. end
  7. end

the database tho is logging like this .....

Lua Code:
  1. [21] =
  2.                         {
  3.                             [1] = "Endoriell",
  4.                             [2] = "Guild Trader (Torment)",
  5.                             [3] = "Mournhold",
  6.                             [4] = 0.588913,
  7.                             [5] = 0.772125,
  8.                         },
  9.                         [22] =
  10.                         {
  11.                             [1] = "Gals Fendyn",
  12.                             [2] = "Guild Trader",
  13.                             [3] = "Mournhold",
  14.                             [4] = 0.586682,
  15.                             [5] = 0.743874,
  16.                         },
  17.                         [23] =
  18.                         {
  19.                             [1] = "Razgugul",
  20.                             [2] = "Guild Trader",
  21.                             [3] = "Mournhold",
  22.                             [4] = 0.595029,
  23.                             [5] = 0.783571,
  24.                         },
  25.                         [24] =
  26.                         {
  27.                             [1] = "Hayaia",
  28.                             [2] = "Guild Trader (Valor)",
  29.                             [3] = "Mournhold",
  30.                             [4] = 0.627713,
  31.                             [5] = 0.775870,
  32.                         },
  33.                         [25] =
  34.                         {
  35.                             [1] = "Through-Gilded-Eyes",
  36.                             [2] = "Guild Trader",
  37.                             [3] = "Mournhold",
  38.                             [4] = 0.633267,
  39.                             [5] = 0.734742,
  40.                         },
  41.                         [26] =
  42.                         {
  43.                             [1] = "Erwurlde",
  44.                             [2] = "Guild Trader",
  45.                             [3] = "Mournhold",
  46.                             [4] = 0.624318,
  47.                             [5] = 0.734251,
  48.                         },
  49.                         [27] =
  50.                         {
  51.                             [1] = "Zarum",
  52.                             [2] = "Guild Trader",
  53.                             [3] = "Mournhold",
  54.                             [4] = 0.579066,
  55.                             [5] = 0.742681,
  56.                         },

trying to get them all to pin

This should work:
lua Code:
  1. local Pins = VendorSavedAccount.Data[Zone .. "/" .. Subzone]
  2. for _, PinData in ipairs(Pins) do
  3.     -- GUILD VENDORS
  4.     if VendorSaved.GuildTrader and (PinData[2]):find(GetString(PIN_GUILDTRADER)) then
  5.         LMP:CreatePin(PinType1, PinData, PinData[4], PinData[5])
  6.     end
  7. end

SkOODaT 08/05/14 09:48 AM

awesome thank you so much that worked perfect, question tho how long does a guild trader hold onto a guild, im thinking im going to half to figure out a way now to have old database guild entries get removed if a new guild takes a guild trader...

katkat42 08/05/14 10:23 AM

Quote:

Originally Posted by SkOODaT (Post 11167)
awesome thank you so much that worked perfect, question tho how long does a guild trader hold onto a guild, im thinking im going to half to figure out a way now to have old database guild entries get removed if a new guild takes a guild trader...

It's a calendar week, from what I understand. Guilds bid for a week, then the winner has the booth for a week while bids are taken for the next week. If a booth has no bids by the end of a bidding round, it goes up for purchase on a first-come, first-served basis, with the first-come guild getting the booth for the rest of the week.


All times are GMT -6. The time now is 05:15 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI