Jump to content
Sign in to follow this  

Recommended Posts

Ordinal Suffix Function
File Name: Ordinal Suffix
File Submitter: Myriad
File Submitted: 5 June 2017
File Category: Quests, Shops, Functions & Algorithms Releases

Ever been constructing a string and wanted to turn 1 into 1st? Or 2 -> 2nd? Well, there is now an answer!
I call it 'Ordinal Suffix'. It adds a suffix to the end of your number using the callfunc() script command. Example below:

.@first = 1;
.@second = 2;
mes("That's the " + callfunc("Ordinal_Suffix", .@first) + " time you told me that!"); // Will return "That's the 1st time you told me that!"
mes("That's the " + callfunc("Ordinal_Suffix", .@second) + " time you told me that!"); // Will return "That's the 2nd time you told me that!"
mes("That's the " + callfunc("Ordinal_Suffix", 11) + " time you told me that!"); // Will return "That's the 11th time you told me that!"

→ Special cases such as '11th', '12th' and '13th' are accounted for.
→ Can only be used with integers.
→ Works for all possible numbers (except 0 will return 0th, not sure what that is supposed to be).

Script can be 'downloaded' at this pastebin link: https://pastebin.com/6Z5k1S70

Edited by Myriad
Made a Pastebin account so I can edit the script when needed.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.