Quantcast
GetSecondsUntilCampaignEnd - ESOUI
Thread Tools Display Modes
05/18/22, 11:23 AM   #1
tim99
 
tim99's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2017
Posts: 19
Question GetSecondsUntilCampaignEnd

Hi all,
is there a special handling of Cyro-related API calls that i am not aware of is it even kinda buggy?

This call always returns "0":

Lua Code:
  1. /script d(GetSecondsUntilCampaignEnd(GetAssignedCampaignId()))

...until you once manually opened the campaign fragment/window (L).


After pressing L once, it returns a real value, which doesnt even gets lost after reloadui.

However logoff to character selection and back in resets it to return 0 all the time, until you opened again the campaign overview.

Same is for several other related calls like GetPlayerCampaignRewardTierInfo and IsUnderpopBonusEnabled.

Last edited by tim99 : 05/18/22 at 11:25 AM.
  Reply With Quote
05/18/22, 12:12 PM   #2
Masteroshi430
 
Masteroshi430's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2020
Posts: 89
Most of campaign data is updated only when you open the campaign menu
Edit: read there : https://www.esoui.com/forums/showthread.php?t=10153

Last edited by Masteroshi430 : 05/18/22 at 12:15 PM.
  Reply With Quote
05/18/22, 01:09 PM   #3
tim99
 
tim99's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2017
Posts: 19
Ok, thx for that! I see where we are going to.

But the funny thing is.... i even used the meantioned function before, but no difference.

Lua Code:
  1. LowPop = LowPop or {}
  2. local lp = LowPop
  3. lp.name = "LowPop"
  4.  
  5. --/script d(GetSecondsUntilCampaignEnd(GetAssignedCampaignId()))
  6. ----------------------------------------------------------------------------------------------------
  7. function lp.addonLoaded(event, addonName)
  8.     if addonName ~= lp.name then return end
  9.     EVENT_MANAGER:UnregisterForEvent(lp.name, EVENT_ADD_ON_LOADED)
  10.    
  11.     QueryCampaignSelectionData()
  12.     --QueryCampaignLeaderboardData()
  13.    
  14.     EVENT_MANAGER:RegisterForUpdate("LowPop_Update", 10000, function()
  15.         --QueryCampaignSelectionData()
  16.         d("|c00FF00 ### TEST GetSecondsUntilCampaignEnd: |r"..tostring(GetSecondsUntilCampaignEnd(GetAssignedCampaignId())))
  17.     end)
  18.    
  19. end
  20. ----------------------------------------------------------------------------------------------------
  21. EVENT_MANAGER:RegisterForEvent(lp.name, EVENT_ADD_ON_LOADED, lp.addonLoaded)

Returns "0" until "campaigns" opened. Anyone an idea why?


BTW:
What i had in mind is an addon to show when the LowPop Bonus gets enabled in Cyro. The above code is just cutted down to figure out whats going on. I used the given EVENT and not a generell 10sec timer to update. Thats just for testing!

Also changed isLowPopEnabled to the campaignEnds thing to be able to test. Was annoying in the beginning to wait until a real LowPop was enabled while spamming that L button

Also on the PTS is doesnt seem to work at all.

!!! If that helps, i can not publish that addon after figuring out, but just use myself and also can delete this post or blank out. So it will not "sum up" but is really just one call
  Reply With Quote
05/18/22, 01:11 PM   #4
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 388
So as mentioned in the thread creating a mod that forces that information to load (because it is heavy on the server) has a chance of resulting in the server gurus going crazy and preventing mods from accessing it altogether.

So while I don't use those features Masteroshi430 mentioned that their mod would try not to cause that to load until after a user uses the menu and the information loads. Hopefully that's how it is working.

If the information you want to display with your new mod is already on the screen after someone opens the campaign menu then why make a mod to display it prior to opening the menu that could lead to not being able to access the information at all.

Just some thoughts. I am of the opinion that when something has the potential to cause the server gurus grief, don't do it.

If your new mod could display a message that the information will be available after they have used the campaign menu then set that expectation. That way anyone using it would know it won't show up on login and only after they are in a campaign.
__________________
Admin for TES5Edit, occasional LOOT masterlist contributor, and Wrye Bash contributor. I also maintain special Fallout 3 and Fallout NV versions of Wrye Flash.

Last edited by Sharlikran : 05/18/22 at 01:27 PM.
  Reply With Quote
05/18/22, 01:13 PM   #5
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 388
Originally Posted by tim99 View Post
Returns "0" until "campaigns" opened. Anyone an idea why?
Maybe they already restrict it because others do this and it creates stress on the server? That is the point everyone is making.
__________________
Admin for TES5Edit, occasional LOOT masterlist contributor, and Wrye Bash contributor. I also maintain special Fallout 3 and Fallout NV versions of Wrye Flash.
  Reply With Quote
05/18/22, 01:31 PM   #6
Masteroshi430
 
Masteroshi430's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2020
Posts: 89
Originally Posted by Sharlikran View Post
So while I don't use those features Masteroshi430 mentioned that their mod would try not to cause that to load until after a user uses the menu and the information loads. Hopefully that's how it is working.
Exactly:
https://www.esoui.com/downloads/info...owdednESO.html
  Reply With Quote
05/19/22, 04:56 PM   #7
tim99
 
tim99's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2017
Posts: 19
ok ok, so no juicy LowPop Addon

I still struggle a bit with: "here you have an Api-Function and Event-Callbacks... but don't use them, the server gets too busy" ...but well. ^^
Maybe i create a wish on the wishlist at some point... since its a like a buff, it's active or not, no need for population data, if thats the problem in the end.

Maybe they can make the existing call "IsUnderpopBonusEnabled" always return a real value like yes or no without loading all cyro data.

Last edited by tim99 : 05/19/22 at 05:03 PM.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » GetSecondsUntilCampaignEnd

Thread Tools
Display Modes

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