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: Global Functions

Previous Thread :: Next Thread 
UnAdmin is not online. UnAdmin
Joined: 10 Jul 2012
Total Posts: 4706
02 Feb 2013 08:26 PM
Hey guys, I'm working on the "Scripters admin script"
An overused script that all scripters should use. It's going to have a butt-ton of functions. I'm a little stumped right now. All I have is:

_G.randomNum(number value of how many decimals you want, number value highest/lowest number, number value of highest/lowest value)

_G.getRange(number 1, number 2) Will always subtract the highest number from lowest

_G.randomText(number value of how many characters you want, true false or nil (True will return a string with upper and lower case characters while false will return a string with uppercase characters and nil will return a string with all lowercase letters ))

_G.tEmpty(table) Will return a bool to see if table is empty or not

Any ideas? I was thinking about a averaging function so don't say that.

~ᴬᴵᴺ'ᵀ ᵀᴴᴬᵀ ᴬ ᴷᴵᶜᴷ ᴵᴺ ᵀᴴᴱ ᴴᴱᴬᴰˑ~
Report Abuse
popdosprlte is not online. popdosprlte
Joined: 18 Dec 2009
Total Posts: 4801
02 Feb 2013 08:29 PM
_G.convertIntoTime(seconds)

Returns

(hours,minutes,seconds)


So _G.convertIntoTime(60)

would return (0,1,0)
Report Abuse
DrHaximus is not online. DrHaximus
Joined: 22 Nov 2011
Total Posts: 8410
02 Feb 2013 08:31 PM
I did something like this ages ago, the truth is that most of the processes you can automate can be easily done without the hassle of debugging a script that is written by someone else.
Report Abuse
UnAdmin is not online. UnAdmin
Joined: 10 Jul 2012
Total Posts: 4706
02 Feb 2013 08:36 PM
I don't need no debuggin'.

~ᴬᴵᴺ'ᵀ ᵀᴴᴬᵀ ᴬ ᴷᴵᶜᴷ ᴵᴺ ᵀᴴᴱ ᴴᴱᴬᴰˑ~
Report Abuse
DrHaximus is not online. DrHaximus
Joined: 22 Nov 2011
Total Posts: 8410
02 Feb 2013 08:39 PM
It's not what you don't need, it's when your script does something that contradict's the user's actions, making the whole project a bit of a waste.
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
02 Feb 2013 08:49 PM
Did you know that eenie meenie miney moe is people[15%#people+1] ?
Report Abuse
UnAdmin is not online. UnAdmin
Joined: 10 Jul 2012
Total Posts: 4706
02 Feb 2013 08:55 PM
I'm including all kinds of conditionals. For example if someone inserts a string value into where a number value should be it will check to see if the string is a number or just text. However the way I have it setup right now will slaughter output.

~ᴬᴵᴺ'ᵀ ᵀᴴᴬᵀ ᴬ ᴷᴵᶜᴷ ᴵᴺ ᵀᴴᴱ ᴴᴱᴬᴰˑ~
Report Abuse
FreeToTake is not online. FreeToTake
Joined: 21 Apr 2010
Total Posts: 1827
03 Feb 2013 06:02 AM
_G.getRange(number 1, number 2)

math.abs works fine. You don't need that.
Report Abuse
FreeToTake is not online. FreeToTake
Joined: 21 Apr 2010
Total Posts: 1827
03 Feb 2013 06:10 AM
other suggestions :

function to find the next prime number
x = 277
print(unpack(_G.nextPrime(x))
> 281

function to remove duplicates from a table
t = {2, 2, 1, 5, 4, 5}
print(unpack(_G.removeDups(t)))
> 2, 1, 5, 4

function to shuffle a table
t = {1, 2, 3, 4, 5}
print(unpack(_G.shuffleTable(t)))
> 3, 1, 2, 5, 4

function to invert a table
t = {1, 2, 3, 4, 5}
print(unpack(_G.invertTable(t)))
> 5, 4, 3, 2, 1

function to sort a table in alphabetical order
t = {"bear","ball","air"}
print(unpack(_G.sortTable(t)))
> air ball bear
Report Abuse
UnAdmin is not online. UnAdmin
Joined: 10 Jul 2012
Total Posts: 4706
03 Feb 2013 07:11 AM
Thank you for your contribution :)

~ᴬᴵᴺ'ᵀ ᵀᴴᴬᵀ ᴬ ᴷᴵᶜᴷ ᴵᴺ ᵀᴴᴱ ᴴᴱᴬᴰˑ~
Report Abuse
SurgenHack is not online. SurgenHack
Joined: 20 Jun 2010
Total Posts: 10
03 Feb 2013 02:32 PM
Random string generator :
function GetRandom(Length)
local Rtn = ""
repeat
Rtn = Rtn .. tostring(string.char(math.random(37,127)))
until #Rtn == Length
return Rtn
end


"Don't believe everything you read online" - Abraham Lincoln
Report Abuse
popdosprlte is not online. popdosprlte
Joined: 18 Dec 2009
Total Posts: 4801
03 Feb 2013 02:54 PM
Here is another;

_G.createLaser(vector31,vector32,thickness)

returns

(object)
Report Abuse
IJustPwndYou is not online. IJustPwndYou
Joined: 06 Mar 2012
Total Posts: 985
05 Feb 2013 07:29 PM
How 'bout this:

_G.soloTest

returns true if the only player in the game is Player1 and has a userId of -1.
Report Abuse
AbsoluteLOL is not online. AbsoluteLOL
Joined: 01 Dec 2012
Total Posts: 3939
05 Feb 2013 07:43 PM
A createObject function? Can be used like so:
_G.createObject(
"Part",
workspace,
{Name = "Test", BrickColor = BrickColor.new("Really black")})

Better yet, here you go:
_G.createObject = functon(type, parent, properties)
local obj = Instance.new(type, parent)
for a, b in pairs(properties) do
pcall(obj[a] = b)
end
end

[ AbsoluteLOL - TFN Prime General ]
Report Abuse
AbsoluteLOL is not online. AbsoluteLOL
Joined: 01 Dec 2012
Total Posts: 3939
05 Feb 2013 07:46 PM
I misspelled "function" :(

[ AbsoluteLOL - TFN Prime General ]
Report Abuse
AbsoluteLOL is not online. AbsoluteLOL
Joined: 01 Dec 2012
Total Posts: 3939
05 Feb 2013 07:47 PM
Aaaand it doesn't work...
fail

[ AbsoluteLOL - TFN Prime General ]
Report Abuse
AbsoluteLOL is not online. AbsoluteLOL
Joined: 01 Dec 2012
Total Posts: 3939
05 Feb 2013 07:49 PM
Fixed.
_G.create = function(type, parent, properties)
local obj = Instance.new(type, parent)
for a, b in pairs(properties) do
if (obj[a] ~= nil) then
obj[a] = b
end
end
end

[ AbsoluteLOL - TFN Prime General ]
Report Abuse
Tenal is not online. Tenal
Joined: 15 May 2011
Total Posts: 18684
05 Feb 2013 07:59 PM
easy

    _G.randomNum = wat
    _G.getRange = function(n1, n2)
        return math.abs(n1 - n2)
    end
    _G.randomText = function(numChar, type)
        local text = ""
        for i = 1, numChar do
            text = text .. (type == true and tick()%2 == 0 and string.char(math.random(97, 122)) or string.char(math.random(97, 122)):upper() or type == false and string.char(math.random(97, 122)):upper() or string.char(math.random(97, 122)))
        end
        return text
    end

    _G.tEmpty = function(tbl)
        return #tbl == 0
    end
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
05 Feb 2013 08:48 PM
It would be much better if we could get a sandboxed compiler where we can do this:

ga.work.Que.Hum.Health = 0;

I'd use that a lot more then another library like jCommands...
Report Abuse
UnAdmin is not online. UnAdmin
Joined: 10 Jul 2012
Total Posts: 4706
05 Feb 2013 08:54 PM
Much like -e?

~ᴬᴵᴺ'ᵀ ᵀᴴᴬᵀ ᴬ ᴷᴵᶜᴷ ᴵᴺ ᵀᴴᴱ ᴴᴱᴬᴰˑ~
Report Abuse
UnAdmin is not online. UnAdmin
Joined: 10 Jul 2012
Total Posts: 4706
06 Feb 2013 07:14 AM
Well here are _some_ of the basics of what I made. I know the random text is a bit funny but too bad. pastebin/fjzz4ypt

~ᴬᴵᴺ'ᵀ ᵀᴴᴬᵀ ᴬ ᴷᴵᶜᴷ ᴵᴺ ᵀᴴᴱ ᴴᴱᴬᴰˑ~
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