Thread Tools Display Modes
04/16/14, 11:28 AM   #1
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 642
Help with Reticle over Fishing Hole error

Irrespective of what the routine's syntax is I get an error when the loading screen closes and the player Reticle is over a Fishing Hole. I have it such that if the players Reticle is over something and GetString(SI_GAMECAMERAACTIONTYPE16) which is fishing, then preform an action.

Code:
if not Harvest.nodes.data[zone] then
		return false
	end
The problem is that the check occurs before the above Harvest.nodes.data[zone] is available. So I can't check it for nil either because the loading screen just went away and for a brief moment the information is not available.

Code:
if Harvest.nodes.data[zone] == nil then
	return
end
This will fail.

Code:
if Harvest.nodes.data == nil then
	return
end
This will fail.

Code:
if Harvest.nodes == nil then
 	return
end
This does not fail so the routine is not used and the error does not occur.

Question is how can I resolve this better? Is there a way to check, if the loading screen is open, and the game is busy, don't do anything?
  Reply With Quote
04/16/14, 11:43 AM   #2
Ouijan
 
Ouijan's Avatar
Join Date: Apr 2014
Posts: 13
You might be able to set a playerReady variable to false and use EVENT_PLAYER_ACTIVATED to change it to true then only perform your function when playerReady is true. I'm not exactly sure if EVENT_PLAYER_ACTIVATED will do what you're after but it looks promising Goodluck

I believe player activated triggers after the loading screen when the player has been loaded into the world but you'll have to investigate that cause I'm not 100% sure

Last edited by Ouijan : 04/16/14 at 11:45 AM.
  Reply With Quote
04/17/14, 03:26 AM   #3
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 642
Originally Posted by Ouijan View Post
You might be able to set a playerReady variable to false and use EVENT_PLAYER_ACTIVATED to change it to true then only perform your function when playerReady is true. I'm not exactly sure if EVENT_PLAYER_ACTIVATED will do what you're after but it looks promising Goodluck

I believe player activated triggers after the loading screen when the player has been loaded into the world but you'll have to investigate that cause I'm not 100% sure
I played around with EVENT_PLAYER_ACTIVATED and didn't have much luck using the right syntax. I went looking in the ESohead.lua, and found this.
Code:
    if IsGameCameraUIModeActive() then
        return
    end
It seems to have fixed my issue.
  Reply With Quote
04/17/14, 06:41 AM   #4
thelegendaryof
 
thelegendaryof's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 161
EVENT_PLAYER_ACTIVATED fires after every loadingscreen - after everything has been initialized completely as in when the "player is ready" which is why you are for example able to use d("test") to ouput your debugging output to the ChatWindow there.

EVENT_ADD_ON_LOADED triggers to early for some game-functions so you're for example not able to output any debugging output to the ChatWindow via d(). That might be the cause in your case at well.

If you use EVENT_PLAYER_ACTIVATED for your intialization instead, make sure you unregister the Event after triggering once otherwise you're bound to have errors as it get 's constantly recalled after every loadingscreen for example when you port around (no, the addons don't get completely reloaded in that case)
  Reply With Quote
04/17/14, 07:59 AM   #5
Ouijan
 
Ouijan's Avatar
Join Date: Apr 2014
Posts: 13
@Legendary: Oh cheers, that's handy to know

@Sharlikran: Cool, i'm glad you figured it out. IsGameCameraUIModeActive() from my understanding checks if user is in mouse more or reticle mode. Which is probably exactly what you want xD Completely forgot about it, my bad.
  Reply With Quote
04/17/14, 08:22 AM   #6
thelegendaryof
 
thelegendaryof's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 161
Forgot to mention it that it can be called to late as well seeing your code involving HarvestNodes leads me to believe it creates custom map-pins which for some reason only worked for me when I was initializing my stuff in EVENT_ADD_ON_LOADED so your solution might be correct/better in that case. ^^
  Reply With Quote
04/17/14, 07:13 PM   #7
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 642
Basically anytime the screen would load like going in a door, my reticle would be over something, and OnUpdate(time) is firing. So once it can't get a property, then it would error. Now that isn't happening. I'm still testing it though.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Help with Reticle over Fishing Hole error


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