RPG Maker Forums

Built-in class Extension's v1.9.5
Author Sarlecc



 
Introduction
This script adds four new methods to the String class and three to the Array class more may be added in the future as I think of them.


Updates:


- v1.5 added three methods to the Array class and changed the name to Built-in class Extension's. (as it now handles more than just Strings)


- v1.6 added mix_up method to String class.


- v1.8 added search method to array class, added prime? method to Math module. Also due to the length of the script putting it up on  mediafire.
- v1.9 added two new methods to the Array class. Also was having problems updating the script so the download link changed...


-v1.9.5 added new prime number checking algorithm. now check if a prime number is prime much faster (slower though on composite numbers)


Features

Spoiler



- Can remove every other character
- Can add characters every other character
- Can convert a string to random characters.


- Can mix the characters in a string.


- Can find the mean.


- Can find the median.


- Can find the range.


- Can search for certain numbers in an array


- Can determine if a number is a prime number


- Can find the id in an array with the lowest value


- Can find the id in an array with the highest value



Screenshots
None needed
 
How to Use
Place script below materials and above main

Code:
#==============================================================================
# String Extension by Sarlecc
# 
# Strings
# "".remove_every(n, d) n = number, d = divsion (optional)
# "Example".remove_every(0, 3)# "".add_every(chars, n, d) chars = characters
# "Example".add_every("u", 2, 4)
# "".rand_chars
# "Example".rand_chars
# "".mix_up
#
# Arrays
# [].mean
# [].median
# [].range
# [].search(num1, num2) num2 is optional
#
# The following two methods return the id with the lowest or highest value in the given range
# both num1 and num2 are optional if omitted or values are to high then it will use 0 and the size 
# of the array
# [].lowest(num1, num2)
# [].highest(num1, num2)
#
# Math
# Math.prime?(num)
# Math.prime2?(num)
# Math.prime2? is on average 2.5 times faster than Math.prime? if the number is prime; otherwise it is around 16-353 times slower
# its recommended that you use Math.prime? for checking thousands of numbers at a time as Math.prime2? will give an error (I assume
# that it has to do with the multithreading and attempting to do the next number while still doing the previous number).
# use Math.prime2? for checking larger primes
# Math.prime? time for number 18987964267331664557:
# 4521.762485 seconds
# Math.prime2? time for number 18987964267331664557:
# 1922.888493 seconds
# Math.prime? time for 106573388391:
# 0.000027-0.000028 seconds
# Math.prime2? time for 106573388391:
# 0.000452-0.009907 seconds
#==============================================================================
 
Demo
Yea none needed.
 
Script
 Script



GitHub

FAQ
None yet.
 
Credit
- Sarlecc

Terms


Author's Notes:


The difference between rand_chars and mix_up is mix_up only returns a string containing characters in that string. The rand_chars method returns random characters that do not necessarily show up in the string. I'm guessing that mix_up might be good for anagrams/scrabble style games?

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,035
Messages
1,018,450
Members
137,820
Latest member
georg09byron
Top