I'm a little confused as to how FB Logic works. My testing doesn't align with the example code on the help page.
This is the demo code:
FacebookSetup("358083327620324")
FacebookLogin()
while GetFacebookLoggedIn() = 0
Print("Logging In...")
Sync()
endwhile
if GetFacebookLoggedIn() = 1
FacebookGetFriends()
while FacebookGetFriendsState() = 0
Print("Getting Friends")
Sync()
endwhile
endif
do
Print("Logged In: " + str(GetFacebookLoggedIn()))
Print("Got Friends: " + str(FacebookGetFriendsState()))
Print("Friend Count: " + str(FacebookGetFriendsCount()))
Sync()
loop
So taking the section after initialisation:
FacebookLogin()
while GetFacebookLoggedIn() = 0
Print("Logging In...")
Sync()
endwhile
This looks like it is looping the program while the FB overlay is in play. However, my tests suggest that the program stops executing until you return from the FB overlay. Is this correct?
Secondly, returning from the FB overlay provides one of two values in my tests...1 for logged in and -1 for cancelled. So I don't understand what this loop is trying to achieve, looping while 0?
If it does serve a purpose, then there is a problem. If you cancel the login, then
GetFacebookLoggedIn() = -1 forever, until you log in.
FacebookLogout() sets the value to -1 too. So if the user cancels, then tries to log in a second time, this loop will immediately end. you cannot assume you are starting FacebookLogin() with a value of 0.
Can anyone unravel this mystery for me please!
Quidquid latine dictum sit, altum sonatur