Thread Tools Display Modes
02/17/18, 04:03 PM   #1
Haaxor1689
 
Haaxor1689's Avatar
Join Date: Dec 2017
Posts: 9
Multiple smaller questions about events and such

I have decided to make an addon to speed up Abah's watch motif farming. I would like to solve some issues and currently don't know how:

1. How can I close a chatter?
I have an EVENT_CONVERSATION_UPDATED callback, that get's called when you enter the 2nd chatter screen with the turn in nps, where is only "goodbye" option. How can I close this automatically?

2. How to open the quest reward container?
I am auto completing the quest with EVENT_QUEST_COMPLETE_DIALOG callback and then by calling the CompleteQuest function. How can I then open the quest reward?

3. Is it possible to automatically interact with object I have reticle on?
With current implementation, player needs to just spam the interact key, while unwated dailies from tip board are abandoned and the desired one is kept. Is there a way to automatically just interact with the board?

4. How to check if a quest is in players journal at addon load?
I would like to register for EVENT_CHATTER_BEGIN only if the quest is active. This needs to be done in init, in case player reloads the UI, but my callback is unnecessarily called all the time.

I would be really glad if you could answer any of my questions Thanks
  Reply With Quote
02/17/18, 04:35 PM   #2
Shinni
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 167
1. How can I close a chatter?
When you seach the lua source for the string "goodbye" you will find the following line:
https://github.com/esoui/esoui/blob/...hared.lua#L395
Lua Code:
  1. self:PopulateChatterOption(optionCount, function() self:CloseChatter() end, farewell, CHATTER_GOODBYE, nil, isImportant, nil, importantOptions)
Here we see how the goodbye dialog option is added. We also see that when the option is selected, it will execute self:CloseChatter()
This means INTERACTION:CloseChatter() and GAMEPAD_INTERACTION:CloseChatter() will close the dialog, depending on the UI mode that is currently used (PC or gamepad)

2. How to open the quest reward container?
These two addons open containers, so you can probably learn how to do it by looking at their code:
http://www.esoui.com/downloads/info1655-Unboxer.html (opens all containers in the inventory)
http://www.esoui.com/downloads/info1...itCrafter.html (open crafting writ reward containers)

3. Is it possible to automatically interact with object I have reticle on?
An interaction is started by calling GameCameraInteractStart().
This function is private and can not be called by addons.

4. How to check if a quest is in players journal at addon load?
All quest info is obtained from the GetJournalQuest*** API functions. Visit https://wiki.esoui.com/API and search for GetJournalQuest .
Quick example
Lua Code:
  1. for index = 1, GetNumJournalQuests() do
  2.   if GetJournalQuestInfo() == "some quest name" then
  3.     d("you have a quest called 'some quest name'")
  4.   end
  5. end

Besides of that, I recommend you to look at Dolgubons Lazy Writ Crafter (linked above). That addon has to track the currently active writ quests, which is rather similar to your use-case, so you should be able to learn from that code.
  Reply With Quote
02/17/18, 05:00 PM   #3
Haaxor1689
 
Haaxor1689's Avatar
Join Date: Dec 2017
Posts: 9
Thanks for your awesome reply. I had already looked at DolgubonsLazyWritCreator but it's quite a big addon with multiple source files, so it was kinda hard to read through. The Unboxer, on a first glance, should help me solve that issue.

For that first point, how can I know which UI mode is being used? Well, until now I didn't even knew you can find the lua source somewhere.
  Reply With Quote
02/17/18, 05:12 PM   #4
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 408
Hey, the function that checks for writs is WritCreator.WritSearch. It's found on line 896 of the WritCreator.lua file. That function checks for the basic writ type. This function iterates over all the quests and can be run at any time.

There's also a function for checking the Master Writs. That is WritCreator.MasterWritQuestAdded on line 442 of MasterWrits.lua. This function is a bit more complex, because it also determines whether the quest is asking for weapons/gear and it sets up the information for the next function. (Which determines what to craft) This function mainly runs only when you accept a quest, and it only runs on one quest index at a time. It is however run on all active quests whenever you login.


You can run the basic writ search with /dlwcfindwrit. /abandonwrits also runs it, though it has the side effect of abandoning all current basic writ quests. /rerunmasterwrits will call the WritCreator.MasterWritQuestAdded function for every single quest.

There's also loot opening in the LootHandler.lua file, mainly in the second half (First half is saving what you get)

Last edited by Dolgubon : 02/17/18 at 05:14 PM.
  Reply With Quote
02/17/18, 05:13 PM   #5
Shinni
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 167
Originally Posted by Haaxor1689 View Post
For that first point, how can I know which UI mode is being used? Well, until now I didn't even knew you can find the lua source somewhere.
If I recall correctly, IsInGamepadPreferredMode() will return true, when the game is in gamepad mode.
  Reply With Quote
02/18/18, 12:46 PM   #6
Haaxor1689
 
Haaxor1689's Avatar
Join Date: Dec 2017
Posts: 9
And can someone suggest any possible way to achieve the repeated quest accepting until the correct one is recieved?
  Reply With Quote
02/19/18, 02:52 AM   #7
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
WIKI + examples:
http://wiki.esoui.com/Main_Page

Source code (local):
http://www.esoui.com/downloads/info1...ourcecode.html

Online searchable:
https://github.com/esoui/esoui/tree/master/esoui

Helping functions within ESO (See attachment)
Attached Files
File Type: txt ESOUIDocumentationP17.txt (615.5 KB, 433 views)
  Reply With Quote
02/19/18, 05:06 AM   #8
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 408
Hey, check the questhandler.lua file in the writ crafter too. If you selectively turn off some crafts in the settings menu, you can see how it will ignore those quests but get all the others. Basically, iirc the function is Select Hatter option or something
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Multiple smaller questions about events and such

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