Banner
Views: 235,908,864
Time: 2013-05-19 03:50:06 PM
19 users online: Akireyano, o An00bis, Archie, Carld923, ErikAlay, Fireblast124, Henix Aurorus, Jolpengammler, Koopster, Lui37, LX5, Magiluigi, MarioFan22, MaxodeX, Pikerchu13, Pixels, o ShadowPhoenix, Sokobansolver, SuperFoofyMan - Guests: 40 - Bots: 19Users: 22,843 (1,293 active)
Latest: IJayZz
Tip: Create a thread for your hack in the Works in Progress once you have enough screenshots/videos to show.
Making ranksets more interesting
Forum Index - Important - Announcements - Making ranksets more interesting
Pages: « 1 2 »
Up until now, ranksets have only been able to access information about users' levels and posts. This has led to the creation of a lot of "standard" ranksets where you simply get a new rank every time you level up. We have a few ranksets that tried to do something a bit more interesting by displaying your post count in various ways (Dots and Binary).

This is all fine, but for a while I have been wanting to create ranksets that are even more dynamic. The idea originated when Smallhacker and I were discussing how awesome it would be to have a Pokémon rankset where the graphic you get for Unown would be calculated from your user ID. We also had the idea that there would be a small chance of some users having shiny Pokèmons instead of regular ones.

Obviously, it doesn't end there. We have a lot of data stored for every user, that might be interesting to combine with a rankset. And thus, I have developed a new rankset API, which will be described in details later in the post. The first rankset to use this will be the upcoming version 2.0 of my Pop-Tart Cat rankset, which will give every single user a uniquely colored Pop-Tart Cat.

Of course, in order to get anything out of this new API as a rankset creator, you would need to either be a PHP programmer or team up with a PHP programmer. If you can't find anyone but have an awesome idea for a rankset, feel free to ask me. If I like your idea, I might help you create it.

For the record, the data you can now access from ranksets is: user ID, username, registration time, whether or not the user is active, gender, name color, post count, thread count, level, donor status and whether or not the user is a staff member.

The rest of this post will contain details on the new API, and probably won't be very interesting for anyone who doesn't program PHP.

First of all, I would like to present you with the interfaces we are working with:

Code
/***************************************************************************** * This is the main interface for ranksets. It is implemented by the Rankset * * parent class, which your rankset must extend. * *****************************************************************************/ interface IRankset { /******************************************************* * The following two methods must be filled in by you. * *******************************************************/ // Must return the friendly name of the rankset for use in the "Edit Profile" select box public static function getName(); // Must return the rank HTML for the specified user public static function getRank(IRanksetUser $user); /*************************************************** * The following methods will be provided for you. * ***************************************************/ // Returns the path of the rankset folder for use in e.g. image URI's public static function getUriPath(); // Returns the path of the rankset folder for use with any file handling functions public static function getFileSystemPath(); } /************************************************************************ * Below is a list of the methods you can expect from the $user object. * ************************************************************************/ interface IRanksetUser { // Returns the ID public function getId(); // Returns the username public function getUsername(); // Returns the registration time public function getRegistrationTime(); // Returns whether the user is active or not public function isActive(); // Returns the gender public function getGender(); // Returns name color public function getNameColor(); // Returns post count public function getPostCount(); // Returns thread count public function getThreadCount(); // Returns level public function getLevel(); // Returns donor status public function isDonor(); // Returns staff status public function isStaff(); }

This may seem overwhelming, but don't panic. Let's take it from the top.

First of all, ranksets are classes. The name of a rankset class must begin with Rankset_, and as stated at the top of the code above, it must extend the class Rankset. This could look something like this:

Code
class Rankset_example extends Rankset { }

Going a bit further in the code, two methods are mentioned: getName() and getRank(). These are the only two methods that you actually need to worry about.

You must create a body for getName() so that it returns a string containing the "pretty" name of your rankset, that is, the name that will be shown in the dropdown box in Edit Profile. You must also create a body for getRank() so that it returns the HTML that makes up that user's rank. Note, though, that getRank() takes an argument. We'll get to that later, but for now, you must include it in your method declaration. It could look like this:

Code
class Rankset_example extends Rankset { public static function getName() { return 'My Example Rankset'; } public static function getRank(IRanksetUser $user) { return 'Hello world!'; } }

So far so good, we now have a valid rankset, even if it's not a very interesting one. This particular rankset would show up as "My Example Rankset" in Edit Profile and give everyone who uses it the rank "Hello world!". This is where the $user variable comes in. If you look at the IRanksetUser interface, you can see a list of all the methods that you can use to access various data through $user. Let's try something simple by outputting a user's level:

Code
class Rankset_example extends Rankset { public static function getName() { return 'My Example Rankset'; } public static function getRank(IRanksetUser $user) { return 'Level ' . $user->getLevel(); } }

Simple. Finally, you can use getUriPath() and getFileSystemPath() to get the path to the rankset directory from the client side and the server side, respectively. For instance, if your rankset were to output an image, you could do this:

Code
class Rankset_example extends Rankset { public static function getName() { return 'My Example Rankset'; } public static function getRank(IRanksetUser $user) { return '<img src="' . self::getUriPath() . '/images/' . $user->getLevel() . '.gif">'; } }

That's it, basically. Feel free to ask if you have any questions. Oh, and create a lot of awesome ranksets.

Edit: added IRanksetUser::isActive()
Last edited on 2011-04-29 04:27:01 PM by Kieran Menor.
Haha, oh god. I wish I knew some PHP. I'm going to love the 2.0 poptart cat. (Cinnamon is my favorite flavor) With the Pokemon idea, I think donating users should have a higher chance of shiny. :D
Last edited on 2011-04-29 10:39:47 AM by Snowshoe.
this now gives me a reason to read up on more advanced php. awesome stuff to hear: i can't wait to see what people come up with with this extension.
Originally posted by algorithmshark
this now gives me a reason to read up on more advanced php. awesome stuff to hear: i can't wait to see what people come up with with this extension.

Took the words out of my mouth.
See, this is why I should learn PHP. It looks like it would be a useful skill to have.
Well here's a project you can use as an excuse to do so.
I like the idea...What about giving the inactive a special rankset, because the most of them have now Pop-Tart cats...
I've been getting into php recently, so if anyone has a good idea for this, I would be willing to help out just to get some more experience.
I support the new type of ranksets, but I think they should be based on things that change regularly, otherwise it's borring to have the same image all the time, so I guess we should invole either thread count or post count in some way.

I say we should have a renkset related with hex numbers, like a rankset similar to binary, but with 16 diferent colors and counts threads instead of posts.
I like that idea, and maybe put something like
Code
0x0485

or
Code
$0485

under it.
How about a rankset reated to your submissions?
I have absolutely no knowledge of PHP or anything of the like, but I still can sit here and blurt out ideas for you all. Here's a list of some:

- A simple rankset that changes the colors of "Level X" based on two factors; your user ID and your number of posts.

- Have more ranksets like the e-peener rankset (I.E. Ones with text and your rank).

- A dynamic MLP rankset. My idea for that is to have 10 ponies from FiM and make their bodies transparent. The color changes for every ones place you rank up, ad the pony changes for every tens place you rank up.

I'll add more when I think of them.
are we allowed to store a txt file with data or something related to the ranksets, so that if some aspect was determined randomly, it would stay permanent?

(think the current setup for the poptart cat rank, except with a txt file with data)

e: more questions i thought of, just to confirm my assumptions:
  1. getRegistrationTime() outputs time in seconds since the unix epoch, right?
  2. what does getGender() return? 'Male', 'Female', and 'N/A'; 0, 1, and 2; or something else entirely?
  3. does getColor() return the color exactly as it was entered, or as hex with the # sign prepended, or without, or in an associative array with decimal number values, or what?
    • i ask because i'm like 80% certain you can enter a CSS colorname in the namecolor profile field, as well as the fact that all of the ways above are valid output options.
  4. is there any chance that we could could be allowed to open sockets and get data from external webpages through an http fsockopen() connection?
Last edited on 2011-04-30 10:30:59 AM by algorithmshark.
are we allowed to store a txt file with data or something related to the ranksets, so that if some aspect was determined randomly, it would stay permanent?
Yes. This, mainly, is why I provided getFileSystemPath().

getRegistrationTime() outputs time in seconds since the unix epoch, right?
Yes.

what does getGender() return? 'Male', 'Female', and 'N/A'; 0, 1, and 2; or something else entirely?
0, 1 and 2, represting N/A, Male and Female, respectively.

does getColor() return the color exactly as it was entered, or as hex with the # sign prepended, or without, or in an associative array with decimal number values, or what?
It outputs a 6 digit hexadecimal number of the format RRGGBB. The value represents your actual name color. That is, if one isn't explicitly specified in your profile, it defaults to the "built-in" colors, exactly as user names do.

is there any chance that we could could be allowed to open sockets and get data from external webpages through an http fsockopen() connection?
No. Not only would it slow down page loading significantly, it would also present a possible security risk.
Originally posted by algorithmshark
  • i ask because i'm like 80% certain you can enter a CSS colorname in the namecolor profile field, as well as the fact that all of the ways above are valid output options.

For anyone who's curious, color names don't work (also, there's a 6-character limit on that field). 3-digit colors do work, though (not like that's relevant here).
for the pokemon idea, i think that the pokemons wich have diferent forms for male/female, change if you have male/female in your profile.
Originally posted by linkunarre
for the pokemon idea, i think that the pokemons wich have diferent forms for male/female, change if you have male/female in your profile.

I actually like this idea, even if the change is slightly noticable and most pokemon don't even change dinner.
Oh man I'd love to get a minecraft rankset giving you something random each time you refresh.
asm rankset

1. BRK #const
2. ORA (dp,x)
3. COP #const
4. ORA sr,s
5. TSB dp
6. ORA dp
7. ASL dp
8. ORA [dp]
9. PHP
10. ORA #const
11. ASL

etc.

or maybe something like, your post count >>X

my post right now >>3 = SBC addr
Last edited on 2011-05-15 02:13:32 PM by Ixtab.
Just a question. If we decide to submit ranksets to you, do we have to now submit them using our own taylored PHP based on this? Or can we just submit it to you and have it implimented using the standard method?
Pages: « 1 2 »
Forum Index - Important - Announcements - Making ranksets more interesting

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2013 - SMW Central
Legal Information - Link To Us


Total queries: 29

Menu