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 » Roblox » Suggestions & Ideas
Home Search
 

Re: (For scripters) Tab fixer

Previous Thread :: Next Thread 
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
27 May 2013 07:33 PM
In scripts people like to use tabs (Or, "indenting") such as

while true do
[TAB] wait(0.03)
[TAB] print("Ok printed")
end

Or

while true do
[TAB] wait(0.03)
[TAB] if true then
[TAB] [TAB] print("Yep, true")
[TAB] end
end

Thats why there is a "auto indent" option

But sometimes the indents get messed up, or if you post it on the forums, they get removed.

My idea is pretty much this

You have this

https://twitter.com/CaptainSandbox/status/339176806894673920/photo/1

But you want it indented, but don't want to go back and add them all in yourself...So

https://twitter.com/CaptainSandbox/status/339176866848075776/photo/1

You click that, and your script becomes...

https://twitter.com/CaptainSandbox/status/339176943800967171/photo/1



This should also work if the current indents are wrong, such as

https://twitter.com/CaptainSandbox/status/339177000243691520/photo/1

Becomes

https://twitter.com/CaptainSandbox/status/339177059714736128/photo/1
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
27 May 2013 07:35 PM
1) Your "fixed" indentation is wrong.

2) I wrote a plugin to do this:

local function getCount(lookIn, findString)
local c = 0;
local w = "";
for m1, m2 in lookIn:gmatch("([%w]*)"..findString.."(%w*)") do
if ((m1 == "") and (m2 == "")) then
c = c + 1;
end
end
return c;
end

local function autoFormat(c, tabChar)
tabChar = tabChar or "\t";
local newCode = { };
local curTabAmount = 0;
if (not c:match("^.-\n$")) then
c = c.."\n";
end
for ln in c:gmatch("(.-)\n") do
ln = ln:gsub("^%s*(.+)", "%1");
local oldTabAmount = curTabAmount;
local totCount = getCount(ln, "function") + getCount(ln, "if") + getCount(ln, "do") + getCount(ln, "repeat") - getCount(ln, "end") - getCount(ln, "until");
curTabAmount = curTabAmount + totCount;
ln = tabChar:rep((totCount > 0) and oldTabAmount or curTabAmount)..ln;
newCode[#newCode + 1] = ln;
end
newCode[#newCode + 1] = "";
return table.concat(newCode, "\n");
end

PluginManager():CreatePlugin()
:CreateToolbar("Auto Tabber")
:CreateButton("Auto Tabber", "Auto Tabber", "").Click:connect(function ()
local sc = game.Selection:Get()[1];
if (sc == nil) then print("Please select a script"); return; end
if (not sc:IsA("BaseScript")) then print("Please select a script"); return; end
sc.Source = autoFormat(sc.Source);
print("Formatted game."..sc:GetFullName());
end);
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
27 May 2013 07:37 PM
"Your "fixed" indentation is wrong."
Tell that to the auto indenter, not me

We shouldn't need a plugin for it.
Report Abuse
dekkonot is not online. dekkonot
Joined: 22 Dec 2010
Total Posts: 6685
27 May 2013 07:48 PM
I agree with this...

~ Linguam latinam est optimum ~
Report Abuse
popdosprlte is not online. popdosprlte
Joined: 18 Dec 2009
Total Posts: 4801
27 May 2013 08:56 PM
Dat last end is tabbed wrongly. should be on the same line as the function it ends.
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
27 May 2013 09:09 PM
@Pop
Again I blame auto indent qq
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
28 May 2013 02:16 PM
Bump again
Report Abuse
yogomaster is not online. yogomaster
Joined: 14 Apr 2013
Total Posts: 854
28 May 2013 02:17 PM
[ Content Deleted ]
Report Abuse
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
28 May 2013 04:14 PM
Or upgrade forums to support posting of code?
Report Abuse
apdapreturns is not online. apdapreturns
Joined: 31 Mar 2012
Total Posts: 1627
29 May 2013 11:38 AM
Support
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
30 May 2013 07:53 PM
http://www.youtube.com/watch?v=DkshOn0jRpw
Report Abuse
cainsuper3 is not online. cainsuper3
Joined: 14 Jul 2009
Total Posts: 2107
30 May 2013 08:21 PM
am I the only 1 who doesn't tab when scripting?
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
31 May 2013 11:16 AM
@Cain
I don't but I know others do, and those others don't like it non tabbed
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Roblox » Suggestions & Ideas
   
 
   
  • 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