ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Multiple smaller questions about events and such (https://www.esoui.com/forums/showthread.php?t=7636)

Haaxor1689 02/17/18 04:03 PM

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

Shinni 02/17/18 04:35 PM

Quote:

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)

Quote:

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)

Quote:

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.

Quote:

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.

Haaxor1689 02/17/18 05:00 PM

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.

Dolgubon 02/17/18 05:12 PM

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)

Shinni 02/17/18 05:13 PM

Quote:

Originally Posted by Haaxor1689 (Post 33961)
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.

Haaxor1689 02/18/18 12:46 PM

And can someone suggest any possible way to achieve the repeated quest accepting until the correct one is recieved?

Baertram 02/19/18 02:52 AM

1 Attachment(s)
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)

Dolgubon 02/19/18 05:06 AM

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


All times are GMT -6. The time now is 08:02 PM.

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