Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by Amir 1 · Mar 20, 2011 at 10:17 AM · staticapisaveloadkongregate

How Can I submit and use statics in Kongregate API

Hi, I need some help.

I'm having problem working with the Kongregate Statics.

I have used this scrip that I've found in Unity-Answers.

I have submitted the same named statics in my script in the Kongregate Statics API

and attached the script to a Gui.text object named KongregateAPI, to show info.

Username found but my problem is nothing was happened with statics variables.

I need to save statics of user and load them for next play.

Such as the level is completed and we can play next level.

Thank you for your help.

var isKongregate = false; var userId = 0; static var username = "Guest"; var gameAuthToken = "";

var texts = ""; static var score = 0; // static 1 static var kills = 0; // static 2 static var gameComplete = 0; // static 3

function OnKongregateAPILoaded(userInfoString){ // We now know we're on Kongregate isKongregate = true; Debug.Log("ON KONG");

// Split the user info up into tokens var params = userInfoString.Split("|"[0]); userId = parseInt(params[0]); username = params[1]; gameAuthToken = params[2]; }

function Awake() { // This game object needs to survive multiple levels DontDestroyOnLoad (this);

 // Begin the API loading process if it is available

Application.ExternalEval( "if(typeof(kongregateUnitySupport) != 'undefined'){" + " kongregateUnitySupport.initAPI('KongregateAPI', 'OnKongregateAPILoaded');" + "}" );

}

function Update () {

  if (Input.GetButtonDown ("Jump")) {
      Application.ExternalCall("kongregate.stats.submit","score",1334);
      Application.ExternalCall("kongregate.stats.submit","kills",6);
      Application.ExternalCall("kongregate.stats.submit","gameComplete",1);
  }


if (isKongregate) texts = "v5 \nKONG is available\nUsernam is : " +username+"\nscore = "+score+"\nkills " +kills+"\ngameComplete : "+gameComplete+"\nPress Space to submit new statics"; else texts = "Not available";

guiText.text = texts; }

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Joshua · Mar 20, 2011 at 03:35 PM 0
Share

Am I correct that you want to use $$anonymous$$ongregates stat submit function to store and retrieve player data? Interesting, never thought of saving your game like that. I'm curious if it's possible, I've never tried to retrieve data from the $$anonymous$$ong API, only submit.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

How do I know if my game is connecting to Kongregate's API? 2 Answers

Can't find and access (used persistentDataPath) saved file after building the game on Android? 1 Answer

Retrieving scores from Kongregate API 0 Answers

Using the Kongregate API 1 Answer

Help with Kongregate API? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges