Thread Tools Display Modes
08/04/14, 02:31 PM   #1
SkOODaT
 
SkOODaT's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 58
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
  Reply With Quote
08/04/14, 03:08 PM   #2
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
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)
  Reply With Quote
08/04/14, 05:25 PM   #3
SkOODaT
 
SkOODaT's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 58
Originally Posted by Garkin View Post
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
  Reply With Quote
08/04/14, 05:50 PM   #4
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
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 "")
  Reply With Quote
08/04/14, 07:14 PM   #5
SkOODaT
 
SkOODaT's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 58
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
  Reply With Quote
08/04/14, 07:46 PM   #6
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by SkOODaT View Post
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

Last edited by Garkin : 08/04/14 at 07:51 PM.
  Reply With Quote
08/05/14, 09:48 AM   #7
SkOODaT
 
SkOODaT's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 58
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...
  Reply With Quote
08/05/14, 10:23 AM   #8
katkat42
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 155
Originally Posted by SkOODaT View Post
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.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » String Manipulation help


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off