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: Can someone convert this to lua?

Previous Thread :: Next Thread 
xPRESIDENTx is not online. xPRESIDENTx
Joined: 10 Jun 2011
Total Posts: 815
18 Dec 2013 03:32 PM


function drawLightning(x1,y1,x2,y2,displace)
{
if (displace < curDetail) {
graf.moveTo(x1,y1);
graf.lineTo(x2,y2);
}
else {
var mid_x = (x2+x1)/2;
var mid_y = (y2+y1)/2;
mid_x += (Math.random()-.5)*displace;
mid_y += (Math.random()-.5)*displace;
drawLightning(x1,y1,mid_x,mid_y,displace/2);
drawLightning(x2,y2,mid_x,mid_y,displace/2);
}
}
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
18 Dec 2013 03:33 PM
What language is this?
Report Abuse
TheNickmaster21 is not online. TheNickmaster21
Joined: 04 Oct 2008
Total Posts: 9490
18 Dec 2013 03:36 PM
No?
Report Abuse
Christbru01 is not online. Christbru01
Joined: 03 Apr 2010
Total Posts: 649
18 Dec 2013 03:58 PM
This looks to be C or PHP or maybe even Java or JavaScript.. basically, it can be any number of languages but Lua.. the Lua version of this script would be:

function drawLightning(x1,y1,x2,y2,displace)
if displace < curDetail then
graf.moveTo(x1,y1)
graf.lineTo(x2,y2)
else
var mid_x = (x2+x1)/2
var mid_y = (y2+y1)/2
mid_x = mid_x + (math.random()-.5)*displace
mid_y = mid_y + (math.random()-.5)*displace
drawLightning(x1,y1,mid_x,mid_y,displace/2)
drawLightning(x2,y2,mid_x,mid_y,displace/2)
end
end
Report Abuse
TheBlackCloth is not online. TheBlackCloth
Joined: 01 Jul 2013
Total Posts: 219
18 Dec 2013 03:59 PM
That is not JavaScript or PHP.
I known both of those very well.
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
18 Dec 2013 03:59 PM
:MoveTo
Report Abuse
shonclub is not online. shonclub
Joined: 05 Sep 2009
Total Posts: 1331
18 Dec 2013 03:59 PM
This seems to be C or C++
Report Abuse
MXrcr20 is not online. MXrcr20
Joined: 01 Oct 2008
Total Posts: 2644
18 Dec 2013 04:00 PM
Also, it's definitely not C either.
Report Abuse
MXrcr20 is not online. MXrcr20
Joined: 01 Oct 2008
Total Posts: 2644
18 Dec 2013 04:01 PM
My guess would be JavaScript. It's definitely not C or C++ because they don't use 'function' when creating a function.
Report Abuse
Christbru01 is not online. Christbru01
Joined: 03 Apr 2010
Total Posts: 649
18 Dec 2013 04:02 PM
@TheBlackCloth: I know both very well aswell, I've created my own website, I currently have a PHP based server used with roblox's new HttpService to make cross-server chat possible, I know them all very well, and this could easily be PHP for sure if it were to be set up correctly..
Report Abuse
MXrcr20 is not online. MXrcr20
Joined: 01 Oct 2008
Total Posts: 2644
18 Dec 2013 04:02 PM
But I'm most likely wrong to say it's JavaScript.
Report Abuse
TheBlackCloth is not online. TheBlackCloth
Joined: 01 Jul 2013
Total Posts: 219
18 Dec 2013 04:05 PM
It's JavaScript.
Report Abuse
xPRESIDENTx is not online. xPRESIDENTx
Joined: 10 Jun 2011
Total Posts: 815
18 Dec 2013 10:36 PM
I got it off a website, its suppost to generate a lighting bolt
Report Abuse
Madified is not online. Madified
Joined: 19 Apr 2011
Total Posts: 5292
18 Dec 2013 10:44 PM
[ Content Deleted ]
Report Abuse
xPRESIDENTx is not online. xPRESIDENTx
Joined: 10 Jun 2011
Total Posts: 815
18 Dec 2013 10:44 PM
I think it may actually be PHP or some website code but idk
Report Abuse
Christbru01 is not online. Christbru01
Joined: 03 Apr 2010
Total Posts: 649
18 Dec 2013 10:49 PM
PHP does require ; inbetween lines, I'm fairly sure it's PHP just by how it's lain out and how it acts with stuff, though it actually could be a good number of different languages..
Report Abuse
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
18 Dec 2013 10:51 PM
Madified...

Lua uses ;
AS3 uses ;
C++ uses ;
Java uses ;

What.
Report Abuse
Zachiah is not online. Zachiah
Joined: 27 Oct 2013
Total Posts: 1401
18 Dec 2013 10:54 PM
It is obviously JavaScript.

PHP does not have the Math.random function, JavaScript does.

To define variables in PHP you use an '$' at the beginning, this uses 'var' which is used in JavaScript.

Why is this so hard?
Report Abuse
TheBlackCloth is not online. TheBlackCloth
Joined: 01 Jul 2013
Total Posts: 219
18 Dec 2013 11:06 PM
Zach, that is the exact reason I said it was JavaScript.
Report Abuse
TheBlackCloth is not online. TheBlackCloth
Joined: 01 Jul 2013
Total Posts: 219
18 Dec 2013 11:08 PM
PiggyJingles, Javascript and PHP also use ;
Report Abuse
Madified is not online. Madified
Joined: 19 Apr 2011
Total Posts: 5292
18 Dec 2013 11:18 PM
[ Content Deleted ]
Report Abuse
TheBlackCloth is not online. TheBlackCloth
Joined: 01 Jul 2013
Total Posts: 219
18 Dec 2013 11:21 PM
You must not know many programming languages.
Report Abuse
Madified is not online. Madified
Joined: 19 Apr 2011
Total Posts: 5292
18 Dec 2013 11:23 PM
[ Content Deleted ]
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
18 Dec 2013 11:29 PM
I have a lightning function that you can use
Report Abuse
xPRESIDENTx is not online. xPRESIDENTx
Joined: 10 Jun 2011
Total Posts: 815
18 Dec 2013 11:31 PM
I got one infocus, but thanks
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