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 » Scripting Helpers
Home Search
 

Re: What does '%' mean?

Previous Thread :: Next Thread 
LUVMARIOLUIGI10000 is not online. LUVMARIOLUIGI10000
Joined: 16 May 2009
Total Posts: 1244
10 Nov 2012 10:43 PM
I know it's a percent sign, but i've seen it in some scripts that have countdowns and others that display a value, usually a string, and im not sure what it's purpose is.
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
10 Nov 2012 10:44 PM
http://wiki.roblox.com/index.php/String_patterns#Character_Classes

I can't explain since there are like my only weakness.

deathCast();
Report Abuse
1waffle1 is online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
10 Nov 2012 10:45 PM
It's used to indicate a string pattern.
Report Abuse
1waffle1 is online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
10 Nov 2012 10:47 PM
    x = "a1b2c3d"
    y = ""
    for z in x:gmatch("[%D]+") do
      y=y..z
    end
    print(y)

> abcd
Report Abuse
LUVMARIOLUIGI10000 is not online. LUVMARIOLUIGI10000
Joined: 16 May 2009
Total Posts: 1244
10 Nov 2012 10:48 PM
@Xx and 1waffle1, thanks.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
10 Nov 2012 10:59 PM
You can also use it to returnt he remainder of a division operation (modulus):

print( 3 % 2 )
--> 1
Report Abuse
CaptainSandbox is not online. CaptainSandbox
Joined: 08 Oct 2012
Total Posts: 908
10 Nov 2012 11:34 PM
Why does 3 % 2 = 1?
Report Abuse
Riderj is not online. Riderj
Joined: 15 Aug 2011
Total Posts: 1534
10 Nov 2012 11:37 PM
% allows you to also use "magic" characters such as %,*,[,],(,),.,+,-,?,etc in your pattern.
Report Abuse
LUVMARIOLUIGI10000 is not online. LUVMARIOLUIGI10000
Joined: 16 May 2009
Total Posts: 1244
10 Nov 2012 11:38 PM
@Captain, I think it's implying division, and 2 goes into 3 once, so there is 1 leftover.
Report Abuse
Riderj is not online. Riderj
Joined: 15 Aug 2011
Total Posts: 1534
10 Nov 2012 11:43 PM
@Captain

The modulus of a number is basically this:

17%3 is the same as (math.floor(17/3)*5)+2
17/3 = 5
(math.floor(17/3)*5)+2 = 17
Report Abuse
Riderj is not online. Riderj
Joined: 15 Aug 2011
Total Posts: 1534
10 Nov 2012 11:45 PM
Ignore that rofl, tired not thinking straight.

17/3 = 5
(5*3)+2 = 17

5 comes from 17%3
Report Abuse
crazyman32 is online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
11 Nov 2012 12:03 AM
Ever do Long Division? '%' basically gives you the 'r' or remainder value.

12%5 = 2, because 5 goes into 12 only up to 10 fully, with a remainder of 2.
Report Abuse
CaptainSandbox is not online. CaptainSandbox
Joined: 08 Oct 2012
Total Posts: 908
11 Nov 2012 12:09 AM
-Feels stupid-

I understand nothing about what Crazyman32 just said...
Report Abuse
CaptainSandbox is not online. CaptainSandbox
Joined: 08 Oct 2012
Total Posts: 908
11 Nov 2012 12:11 AM
Oh wait like this? (Not sure how this will turn out after I press post, Hope for the best)

2 R2
___
5|12
-10
----
2
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
11 Nov 2012 12:13 AM
Exactly.
Report Abuse
CaptainSandbox is not online. CaptainSandbox
Joined: 08 Oct 2012
Total Posts: 908
11 Nov 2012 12:13 AM
That looks nothing like how it looked before I pressed post xP
Ima try and fix it while I post this

.....2 R2
..___
5|12
..-10
...----
......2

I used dots because my spaces got removed
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
11 Nov 2012 12:16 AM
        2 R2
   .------
5 | 1 2
   - 1 0
    ------
        2





:D ?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
11 Nov 2012 12:22 AM

     ------
    5| 12
      -10
    -------
    R2

:D?

¤¤ †KMXD† ¤¤
Report Abuse
CaptainSandbox is not online. CaptainSandbox
Joined: 08 Oct 2012
Total Posts: 908
11 Nov 2012 12:23 AM
Show off -.-

Jk xD

How did you make it not auto remove your spaces?
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
11 Nov 2012 12:23 AM
That's not how I learned my long division. >:o
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
11 Nov 2012 12:24 AM
@Captain

Use Alt+0160.
Report Abuse
CaptainSandbox is not online. CaptainSandbox
Joined: 08 Oct 2012
Total Posts: 908
11 Nov 2012 12:25 AM
I learned mine how you typed it :P
Report Abuse
CaptainSandbox is not online. CaptainSandbox
Joined: 08 Oct 2012
Total Posts: 908
11 Nov 2012 12:26 AM
(Presses alt+0160)

(Gets nothing)
Report Abuse
SN0X is not online. SN0X
Joined: 24 Oct 2011
Total Posts: 7277
11 Nov 2012 01:13 AM
You need a numpad ...

To use regular numbers you press alt+fn+ctrl+n+p+numpad+0160

Yeah that's a lot of buttons...just copy and paste
Report Abuse
CaptainSandbox is not online. CaptainSandbox
Joined: 08 Oct 2012
Total Posts: 908
11 Nov 2012 01:24 AM
I have a number pad

   Test
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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