generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Point Access Interface (or PAI for short)

Previous Thread :: Next Thread 
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
31 Oct 2011 04:30 PM
Because I love you guys, I've developed a Point Access Interface, or an easy to use API for integration of point storage to Data Persistence.

pastebin: SgTswHxN

As noted in the code, here is the API:

    class pai{
        function LoadPointData(Player player, string key) returns int value;
        function SavePointData(Player player, string key, int value);
        function GetLastSaveTime(Player player) returns number seconds;
    }

Enjoy! :D
Report Abuse
LocalChum is not online. LocalChum
Joined: 04 Mar 2011
Total Posts: 6906
31 Oct 2011 04:30 PM
Cake.
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
31 Oct 2011 04:31 PM
I haven't tested this yet, so it might be buggy. Hell, it might not work at all.
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
31 Oct 2011 04:34 PM
Oh, and to use it just drop the code portion into the top of your code.
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
31 Oct 2011 04:36 PM
Note that if more than one script tries to use this, it may overwrite some data, so please try to have only one script use this API.
Report Abuse
popinman322 is not online. popinman322
Joined: 04 Mar 2009
Total Posts: 5184
31 Oct 2011 04:36 PM
Why not save a function as a string and use it later to restore the data? @_@

~+[CROOKITY BANDED SNAKES]+~
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
31 Oct 2011 04:37 PM
"Why not save a function as a string"

you lost me there
Report Abuse
popinman322 is not online. popinman322
Joined: 04 Mar 2009
Total Posts: 5184
31 Oct 2011 04:38 PM
You obviously don't know how2lua then.

~+[CROOKITY BANDED SNAKES]+~
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
31 Oct 2011 04:39 PM
Just because I don't use inefficient coding styles doesn't mean I don't know how2lua.
Report Abuse
popinman322 is not online. popinman322
Joined: 04 Mar 2009
Total Posts: 5184
31 Oct 2011 04:41 PM
[ Content Deleted ]
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
31 Oct 2011 04:42 PM
*title*

You spelled API wrong.
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
31 Oct 2011 04:44 PM
"*title*
You spelled API wrong."

no, PAI is an acronym for Point Access Interface
Report Abuse
NXTBoy is not online. NXTBoy
Joined: 25 Aug 2008
Total Posts: 4533
31 Oct 2011 04:53 PM
What do you mean by "Point Storage"?
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
31 Oct 2011 04:55 PM
>What do you mean by "Point Storage"?
A more efficient way to store points. By points I mean leaderboard data.
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
31 Oct 2011 04:56 PM
:| forgot to add an extra newline after the quote
Report Abuse
NXTBoy is not online. NXTBoy
Joined: 25 Aug 2008
Total Posts: 4533
31 Oct 2011 04:57 PM
Ah. I was thinking point as in Vector3. Might be better to change it to "Score"
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
31 Oct 2011 04:58 PM
Access to the non-minified version:

pastebin: ATBpMtTL
Report Abuse
pwnedu46 is not online. pwnedu46
Joined: 23 May 2009
Total Posts: 7534
31 Oct 2011 05:02 PM
" local function ns(n) -- num to string
                local c=math.floor(math.log(n)/math.log(2^8));
                local s="";
                for m=1,c do
                        s=s..string.char(math.floor(n/(2^(8*c)))%2^8);
                end
                return s;"

Uhh...How did you figure out the math for that. I don't see what you need the logarithms for. :o
Report Abuse
NXTBoy is not online. NXTBoy
Joined: 25 Aug 2008
Total Posts: 4533
31 Oct 2011 05:09 PM
Way overcomplicated. This is better:

    local function numToString(n)
        if n ​>= 0 and n < math.huge then
            local s="";
            repeat
                s = s .. string.char(n % 256)
                n = math.floor(n / 256)
            until n == 0
            return s;
        end
    end
Report Abuse
NXTBoy is not online. NXTBoy
Joined: 25 Aug 2008
Total Posts: 4533
31 Oct 2011 05:11 PM
Or if you want the other endianity:

    local function numToString(n)
        if n ​>= 0 and n < math.huge then
            local s="";
            repeat
                s = string.char(n % 256) .. s
                n = math.floor(n / 256)
            until n == 0
            return s;
        end
    end
Report Abuse
JulienDethurens is not online. JulienDethurens
Joined: 11 Jun 2009
Total Posts: 11046
31 Oct 2011 05:54 PM
Saving functions as strings is easy, you just string.dump the function and save it as a string. When you want to run the function, you load the string and you use it as an argument to loadstring.
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
31 Oct 2011 05:58 PM
>Saving functions as strings is easy, you just string.dump the function and save it as a string. When you want to run the function, you load the string and you use it as an argument to loadstring.

Yet it shouldn't be done willy-nilly.
Report Abuse
Radioaktiivinen is not online. Radioaktiivinen
Joined: 25 Apr 2009
Total Posts: 18629
01 Nov 2011 12:32 AM
"Efficient"

Just save the whole leaderboard instance. Anything else lags your Lua more.
Report Abuse
GigsD4X is not online. GigsD4X
Joined: 06 Jun 2008
Total Posts: 3794
01 Nov 2011 12:34 AM
I love you guys.
Report Abuse
Radioaktiivinen is not online. Radioaktiivinen
Joined: 25 Apr 2009
Total Posts: 18629
01 Nov 2011 04:36 AM
*makes game*

*uses admin to save complex script in 3 parts to 3 different persons data*

*makes script to combine and run em if they all enter the server*

"HURR DURR YOU SHALL LE FIND YE OLDE 3 MASTARS OF ROBLOXIA AND LE GAME sHALL COM ALIVE PL0X ._."
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image