GPGS, what should happen with achievement notification?

Hi,

just thought I would give GPGS a go for the first time.

I just wanted to ask :

  1. if the user starts the game should GPGS auto log you in or do you have to click the login button ?

  2. when an achievement is reached should a box with a notification pop up to let you know during play ?

  3. am I using this code correctly, I am using a plugins sample, see below

  4. any help would be appreciated, thank you

[lua]

local left = display.screenOriginX + display.viewableContentWidth/100
    local top = display.screenOriginY + display.viewableContentHeight/100
    local width = display.viewableContentWidth - display.viewableContentWidth/100
    local size = display.viewableContentHeight/15
    local buttonTextSize = display.viewableContentWidth/20

    local scoreText = display.newText (string.format("%d", passScore),100,200, “cherill”, 32)–y,x

    – Submits the score from the scoreTextField into the leaderboard
    local function submitScoreListener(event)
        gameNetwork.request(“setHighScore”,
            {
                localPlayerScore =
                {
                    category = leaderboardId, – Id of the leaderboard to submit the score into
                    value = _G.passScore – The score to submit
                }
            })
    end

    local function unlockAchievementListener(event)

      if levelCounter == 5 then
        gameNetwork.request(“unlockAchievement”,
            {
                achievement =
                {
                    identifier = CgkIk5nz168eEAIQAQ – The id of the achievement to unlock for the current user
                }
            })
      end

      if levelCounter == 10 then
         gameNetwork.request(“unlockAchievement”,
            {
                achievement =
                {
                    identifier =CgkIk5nz168eEAIQAg – The id of the achievement to unlock for the current user
                }
            })
      end

      if levelCounter == 25 then
         gameNetwork.request(“unlockAchievement”,
            {
                achievement =
                {
                    identifier = CgkIk5nz168eEAIQBQ-- The id of the achievement to unlock for the current user
                }
            })
      end

      if levelCounter == 50 then
         gameNetwork.request(“unlockAchievement”,
            {
                achievement =
                {
                    identifier = CgkIk5nz168eEAIQBw – The id of the achievement to unlock for the current user
                }
            })
      end

      if gemAmountCounter == 1000 then
         gameNetwork.request(“unlockAchievement”,
            {
                achievement =
                {
                    identifier = CgkIk5nz168eEAIQCA – The id of the achievement to unlock for the current user
                }
            })
      end

      if gemAmountCounter == 5000 then
         gameNetwork.request(“unlockAchievement”,
            {
                achievement =
                {
                    identifier = CgkIk5nz168eEAIQAw – The id of the achievement to unlock for the current user
                }
            })
      end

      if gatewayCounter == 10 then
         gameNetwork.request(“unlockAchievement”,
            {
                achievement =
                {
                    identifier = CgkIk5nz168eEAIQBA – The id of the achievement to unlock for the current user
                }
            })
      end
    end

    local function showLeaderboardListener(event)
        gameNetwork.show(“leaderboards”) – Shows all the leaderboards.
    end

    local function showAchievementsListener(event)
        gameNetwork.show(“achievements”) – Shows the locked and unlocked achievements.
    end

    local loginLogoutButton
    local function loginLogoutListener(event)
        local function loginListener(event1)
            – Checks to see if there was an error with the login.
            if event1.isError then
                loginLogoutButton:setLabel(“Login”)
            else
                loginLogoutButton:setLabel(“Logout”)
            end
        end

        if gameNetwork.request(“isConnected”) then
            gameNetwork.request(“logout”)
            loginLogoutButton:setLabel(“Login”)
        else
            – Tries to login the user, if there is a problem then it will try to resolve it. eg. Show the log in screen.
            gameNetwork.request(“login”,
                {
                    listener = loginListener,
                    userInitiated = true
                })
        end
    end

    local scoreSubmitButton = widget.newButton
    {
        top = 50,
        left = left,
        width = width,
        height = size,
        label = “Submit Score”,
        fontSize = buttonTextSize,
        onRelease = submitScoreListener,
    }

    local achievementSubmitButton = widget.newButton
    {
        top = scoreSubmitButton.y + scoreSubmitButton.height/2,
        left = left,
        width = width,
        height = size,
        label = “Unlock Achievement”,
        fontSize = buttonTextSize,
        onRelease = unlockAchievementListener,
    }

    --show leaderboard button
    local showLeaderboardButton = widget.newButton
    {
        top = display.screenOriginY + display.viewableContentHeight/2,
        left = left,
        width = width,
        height = size,
        label = “Show Leaderboard”,
        fontSize = buttonTextSize,
        onRelease = showLeaderboardListener,
    }

    --show achievement button
    local showAchievementButton = widget.newButton
    {
        top = showLeaderboardButton.y + showLeaderboardButton.height/2,
        left = left,
        width = width,
        height = size,
        label = “Show Achievements”,
        fontSize = buttonTextSize,
        onRelease = showAchievementsListener,
    }

    --login button
    loginLogoutButton = widget.newButton
    {
        top = 150,
        left = left,
        width = width,
        height = size,
        label = “Login”,
        fontSize = buttonTextSize,
        onRelease = loginLogoutListener,
    }

    – Checks if the auto login worked and if it did then change the text on the button
    if gameNetwork.request(“isConnected”) then
        loginLogoutButton:setLabel(“Logout”)
    end

[/lua]

Just a follow up.

ok, so I am not passing a string, missed the quotes! doh

Achievements is working now, I just have to adjust my comparators as they are a little slack. If the player goes over the ==1000 etc it dosnt register as it is passed !..

I need to pay more attention.

So I figure if I fire the acheivemnet function function when the item or whatever is earned it should show a pop up in game play…lets see

thanks

Just a follow up.

ok, so I am not passing a string, missed the quotes! doh

Achievements is working now, I just have to adjust my comparators as they are a little slack. If the player goes over the ==1000 etc it dosnt register as it is passed !..

I need to pay more attention.

So I figure if I fire the acheivemnet function function when the item or whatever is earned it should show a pop up in game play…lets see

thanks