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: ROBLOX hates my scripts.

Previous Thread :: Next Thread 
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
19 Apr 2012 09:53 PM
21:51:17 - Players.Player.PlayerGui.Main:4532: main function has more than 200 local variables

-_____________-
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
19 Apr 2012 09:56 PM
Yes, how dare you try to be as efficient and practical as possible?

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
Brandonhare is not online. Brandonhare
Joined: 02 May 2007
Total Posts: 11005
19 Apr 2012 09:59 PM
What are you doing? Is it better to use a table/database?
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
19 Apr 2012 10:02 PM
It actually turned it to be the problem of me copying and pasteing my script twice. :/

This is what my (one) script looks like at the head:
All of the plaining ones are item in the player that are designed to save the data in them for DP, server to client communication, or from death to death. All the game:GetService() ones are for JulienDethuren's header debug code. All of them rest is global data that needs to be shared between functions.

Aren't you glad that all those global data points aren't in object values?

:/

local Players = game:GetService('Players')
local StarterPack = game:GetService('StarterPack')
local StarterGui = game:GetService('StarterGui')
local Lighting = game:GetService('Lighting')
local Debris = game:GetService('Debris')
local Teams = game:GetService('Teams')
local BadgeService = game:GetService('BadgeService')
local InsertService = game:GetService('InsertService')
local Terrain = Workspace.Terrain
local plyr = script.Parent.Parent
local scrgui = script.Parent.ScreenGui
local ShopBills = script.Parent --scrgui.BillboardGUISHidden--script.Parent--.ShopBillboards
local ToolSaveSpot = script.Parent.ToolSaveSpot
local CompassContainer = scrgui.MainInterface.Compass.Backing
local CompassRadius = 126--113
local SmoothnessFact = 0.25 -- A decrease will result in a faster compass speed w/ inertia.

local ChatHistory = 10
local DefaultTeamColor = BrickColor.new("Br. yellowish green")
local VIP = {"-No One-","prorob"}
local VIPBadgeID = 0 -- For whenever I want someone to buy a shirt to get VIP. :D
local Admin = {"Quenty", "Player", "JulienDethurens", "brandonhare"}
local Brandonhare = {"Sorcus", "brandonhare"} --Just to mess with them
local VolcanoFodder = {} -- People who I want to mess with (badly)
local Banned = {} -- Probably useless, but I might as well disable a few things.
local ShipHealthPointName = "Points" --What the unit is called when ships take damage. In this case, Points. :/
local OceanLevel = 62 -- Used for swimming only.
local PlayIntro = false
local RecolorPartName = "recolor"
local Cities = {Workspace.SorcusCity, Workspace.NyuntCity}

local ShipRunning = false
local ShownItem -- Object Value.
local OldCoordinateFrame = CFrame.new(0,0,0)
local OldFocus = CFrame.new(0,0,0)
local Tilt = 0.1
-- Cannon firing.
local SmokeExistanceTime = 2
local CannonVelocity = 300 -- Probably a easy click and drag option....
local CannonLifeTime = 60 -- Length of cannon ball's existance in seconds.
local maxfiretime = 1 -- The delay between when the player calls the fire, and when it fires.
local lestfiretime = 0.1 -- Smallest Fire time possible
local multiplier = 100 -- How close together are the random numbers? On the 10 = 0.1, 100 = 0.01, etc, etc.
local FirstTime = false -- First time playing?

-- Arrow Guideline Setup Variables --
-- Credit to HotTroth/ROBLOX for this script. Heavily modified by meh. :P
local tailLength = 2 -- 2 or 7 --How many tails we have.
local dSize = 0 -- because we want the targets to all be the same size (tail isn't larger anymore; just "ghost" effect)
local dTime = 0.04 --0.025 --Update speed of tails.
local targetLockSize = 0.10 --(0.2) Size of the lock items.
local arrowSize = 0.05 --Size of the arrows.
local arrowScreenProportionSize = .95
local arrowMoveFactor = .025
local targetMoveFactor = targetLockSize / 2 - .025
local halfDSize = dSize / 2
local upArrow = scrgui.GuiArrowFrame.UpArrow
local downArrow = scrgui.GuiArrowFrame.DownArrow
local leftArrow = scrgui.GuiArrowFrame.LeftArrow
local rightArrow = scrgui.GuiArrowFrame.RightArrow
local targetArrowLock = scrgui.GuiArrowFrame.TargetLock
local arrowList = {upArrow, downArrow, leftArrow, rightArrow, targetArrowLock}
local arrowHeightAugment = 0.0
local arrowWidthAugment = 0.0
local targetHeightAugment = 0.0
local targetWidthAugment = 0.0
local lastTime = 0
local targetLockList = {targetArrowLock}

-------------------

local Stats = plyr:FindFirstChild("Stats")

local SetupConnections = {} -- Ship Setup connections
local isVIP -- I like using camalCase and ParscalCase... GOSH.
local isAdmin
local City -- THe current city (Home city)
local isBrandonhare
local IsVIP
local IsAdmin
local IsBrandonhare
local ForceField --The ForceField object...
local ExpPoints
local ShipMaxHealth
local CargoSpaces
local ShipSpeed
local CannonReloadTime
local TeamName
local ShipName
local Ship
local Inventory
local TeamColor
local PlayerShipType
local CannonDamage
local PlayerMaxHealth
local SwordSkill
local GunSkill
local ShipTurnSpeed
local PlayerWalkSpeed
local ShipHealth
local Gold
local Bind_HUD
local Bind_Inventory
local ShipConfigTab


Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
19 Apr 2012 10:04 PM
Whoops, missed a few.


local PreloadAssetList = {"43375123","43375123","50548412","3550245","3550245","3550245","3550245","3550245","3550245","3550245","3550245","3550245","3550245","3550245","3550245","3550245","3550245","3550245","3550245","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","43375123","43375123","43375123","43375123","43375123","43375123","43375123","43375123","43375123","43375123","43375123","43375123","43375123","43375123","43375123","43375123","43375123","43375123","43375123","43375123","43375123","43375123","43375123","43375123","43375123","2062752","2062752","2062752","2062752","2062752","2062752","24334001","24334001","24334001","11202360","11202360","24334001","24334001","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2929289","2929289","6930008","6930008","6930008","6930008","2929289","2929289","6930008","6930008","6930008","6930008","2929289","2929289","6930008","6930008","6930008","6930008","2929289","2929289","6930008","6930008","6930008","6930008","2929289","2929289","6930008","6930008","6930008","6930008","2929289","2929289","6930008","6930008","6930008","6930008","2929289","2929289","6930008","6930008","6930008","6930008","2929289","2929289","6930008","6930008","6930008","6930008","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2929289","2929289","6930008","6930008","6930008","6930008","2929289","2929289","6930008","6930008","6930008","6930008","2929289","2929289","6930008","6930008","6930008","6930008","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2062752","2929289","2929289","6930008","6930008","6930008","6930008","2929289","2929289","6930008","6930008","6930008","6930008","2929289","2929289","6930008","6930008","6930008","6930008","2929289","2929289","6930008","6930008","6930008","6930008","34696003","34696003","34696003","34696003","68559529","76823313","76823416","76823313","76823416","76823313","76823416","76823313","76823416","76823313","76823416","76823313","76823416","76823313","76823416","76823313","76823416","76823313","76823416","76884140","76884140","76884140","76884140","76433905","45840894","45840891","45840870","45840878","45840911","45840925","45840900","45840905","67495474","/ThumbnailAsset.ashx?fmt=png&wd=420&ht=420&aid=67496809","68953365","68953365","68953365","68953365","68952123","70786797","70786797","74611159","68957466","70783858","68953365","68953365","68953365","68953365","68952123","68957466","68953365","68953365","68953365","68953365","68953365","68953365","68953365","68953365","68952123","75560903","75002635","75663225","75705335","75674821","75705180","75705967","75775087","75776310","75778077","75777387","68953365","68953365","68953365","68953365","68953365","68953365","68953365","68953365","75886943","75887041","75887041","75887041","75887194","75887041","75887041","75887041","68953365","68953365","75954327","75954336","48972653","48972682","48972703","49321779","48972729 ","58887765","2929289","2929289","6930008","6930008","6930008","6930008","2929289","2929289","6930008","6930008","6930008","6930008","2929289","2929289","6930008","6930008","6930008","6930008","2011289","2011289","2011289","2011289","4641280","4641280","2011289","2011289","2011289","2011289","4641280","4641280","2011289","2011289","2011289","2011289","4641280","4641280","2011289","2011289","2011289","2011289","4641280","4641280","2011289","2011289","2011289","2011289","4641280","4641280","2011289","2011289","2011289","2011289","4641280","4641280","2011289","2011289","2011289","2011289","4641280","4641280","2929289","2929289","6930008","6930008","6930008","6930008","2929289","2929289","6930008","6930008","6930008","6930008","2929289","2929289","6930008","6930008","6930008","6930008","2011289","2011289","2011289","2011289","4641280","4641280","2011289","2011289","2011289","2011289","4641280","4641280","2011289","2011289","2011289","2011289","4641280","4641280","2011289","2011289","2011289","2011289","4641280","4641280","2011289","2011289","2011289","2011289","4641280","4641280","2011289","2011289","2011289","2011289","4641280","4641280","2011289","2011289","2011289","2011289","4641280","4641280","12880317","12900967","12880317","12900967","12880317","12900967","12880317","12900967","12880317","12900967","12880317","12900967","12880317","12900967","58907271","19366214"}


local PointBasedShipConfig = {--The settings that players can buy in the Ship Stats configuration.
{
Name = "Cannon Reload Time",
UnitTypePlur = "seconds",
UnitTypeSing = "second",
BaseUnitNum = 4,
IncreaseBy = -0.25,
InvestedPoints = 0,
ZeroUnit = "0",
ObjectValue = "CannonReloadTime",
Available = true
},{
Name = "Cargo Space",
UnitTypePlur = "slots",
UnitTypeSing = "slot",
BaseUnitNum = 20,
IncreaseBy = 3,
InvestedPoints = 0,
ZeroUnit = "No",
ObjectValue = "CargoSpaces",
Available = true
},{
Name = "Ship Health",
UnitTypePlur = "HP",
UnitTypeSing = "HP",
BaseUnitNum = 1600,
IncreaseBy = 150,
InvestedPoints = 0,
ZeroUnit = "No",
ObjectValue = "ShipMaxHealth",
Available = true
}, {
Name = "Ship Speed",
UnitTypePlur = "studs per a second",
UnitTypeSing = "stud per a second",
BaseUnitNum = 15,
IncreaseBy = 2,
InvestedPoints = 0,
ZeroUnit = "Zero",
ObjectValue = "ShipSpeed",
Available = true
}, {
Name = "Player Health",
UnitTypePlur = "",
UnitTypeSing = "",
BaseUnitNum = 100,
IncreaseBy = 20,
InvestedPoints = 0,
ZeroUnit = "0",
ObjectValue = "PlayerMaxHealth",
Available = true
}, {
Name = "Cannon Damage",
UnitTypePlur = "damage",
UnitTypeSing = "damage",
BaseUnitNum = 100,
IncreaseBy = 50,
InvestedPoints = 0,
ZeroUnit = "0",
ObjectValue = "CannonDamage",
Available = true
}, {
Name = "Sword Skill",
UnitTypePlur = "times the damage",
UnitTypeSing = "times the damage",
BaseUnitNum = 1,
IncreaseBy = 0.1,
InvestedPoints = 0,
ZeroUnit = "No",
ObjectValue = "SwordSkill",
Available = false
}, {
Name = "Gun Skill",
UnitTypePlur = "x Damage",
UnitTypeSing = "x Damage",
BaseUnitNum = 1,
IncreaseBy = 0.1,
InvestedPoints = 0,
ZeroUnit = "No",
ObjectValue = "GunSkill",
Available = false
}, {
Name = "Player Walkspeed",
UnitTypePlur = "",
UnitTypeSing = "",
BaseUnitNum = 16,
IncreaseBy = 1,
InvestedPoints = 0,
ZeroUnit = "0",
ObjectValue = "PlayerWalkSpeed",
Available = true
}, {
Name = "Ship Turn Speed",
UnitTypePlur = "turn",
UnitTypeSing = "turn",
BaseUnitNum = 0.5,
IncreaseBy = 0.05,
InvestedPoints = 0,
ZeroUnit = "No",
ObjectValue = "ShipTurnSpeed",
Available = true
}
}


-- Text can not be longer then the line '|' to the right. The text will not auto return (Word Wrap).
--------------------------------------------------------------------------------------------------------|
local HelpFileOpen = 1

local HelpFiles = {
{Title = "Trade Enterprise. What is it?", Text = [=======[
So, you may ask, what is Trade Enterprise? Trade Enterprise is a game designed by Quenty. The goal is
to learn about Lua, while creating a fun, interesting game that can be played by almost anyone.
overall, this game is to be a learning experience. A way to learn about creating stuff. Therefore,
do not expect extreme professionalism. Please do, however, report stuff to Quenty when it breaks. A
lot of ideas for this game, and concepts, along with general productions have been created by looking
at other games. If you don't like this, please don't complain!

The game will hopefully utilize OOP (Object Orient Programming), and let me learn how to create a nice
game by looking at all the flaws in the current code. I hope to make parts of it into a libary.

The building was done (mostly) by me. There are a few sections that people donated to put into the
game, and other small sections that were free models (Such as Meshes), however, I built every city, and
99.9% of it is me.

]=======]}
}
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
19 Apr 2012 10:04 PM
@Brandonhare Looking for a database? There it is. :/
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
19 Apr 2012 10:06 PM
@Brandonhare Please disregard that table named 'Brandonhare' kthxbai.
Report Abuse
Legend26 is not online. Legend26
Joined: 08 Sep 2008
Total Posts: 10586
19 Apr 2012 10:14 PM
You can get rid of a ton of those by using a sort of struct of Data for each category and perhaps pulling the information for banlist and such from a server script.
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
19 Apr 2012 10:15 PM
Yeah....

Quite possibly. However, that's only one variable. I just have a big script.
Report Abuse
Legend26 is not online. Legend26
Joined: 08 Sep 2008
Total Posts: 10586
19 Apr 2012 10:22 PM
Looks to me that your script is getting a bit too hard for you to manage. I'd really suggest breaking it up, at least a little.
Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
19 Apr 2012 10:29 PM
Compartmentalize your stuff more. Most of that should be in separate namespaces, or if you like OOP like me, classes. Then you can also easily associate methods right with the data that they operate on, makes stuff cleaner.
Report Abuse
Brandonhare is not online. Brandonhare
Joined: 02 May 2007
Total Posts: 11005
19 Apr 2012 10:29 PM
Why do you have a lot of the variables twice?
eg.
isBrandonhare
IsBrandonhare

It's not worth doubling your variables just for interchangeable case.
Report Abuse
JulienDethurens is not online. JulienDethurens
Joined: 11 Jun 2009
Total Posts: 11046
19 Apr 2012 10:30 PM
Separate your scripts in many different scripts, but do it in a logical way. For example, put stuff that has to do with GUIs in the GUIs, camera stuff in the playergui/backpack/character, ship stuff in the character...

Then, use values, BindableFunctions and BindableEvents to make these different scripts able to communicate with eachothers.

For example, if the GUI wants to make the camera move, it doesn't do it itself, it asks the camera thing to do it, and if the ship wants to show a GUI, it asks the GUI thing to do it.

Basically, separate your whole place into separate "modules" that each do certain things and allow other "modules" to use them.
Report Abuse
Anaminus is not online. Anaminus
Top 100 Poster
Joined: 29 Nov 2006
Total Posts: 5945
19 Apr 2012 10:32 PM
That's what you get for having one script do multiple jobs. If you are going to do that, at least organize your code such that it would be really easy to divide into multiple scripts.
Report Abuse
JulienDethurens is not online. JulienDethurens
Joined: 11 Jun 2009
Total Posts: 11046
19 Apr 2012 10:32 PM
And yeah, use OOP, as Stravant suggested.

If you have over 1000 lines of code, you definitely need OOP.

I'd suggest waiting for Stravant's class system to be added to the RbxUtility library.
Report Abuse
Tenal is not online. Tenal
Joined: 15 May 2011
Total Posts: 18684
19 Apr 2012 10:43 PM
local IsBrandonhare
lol
Report Abuse
Tenal is not online. Tenal
Joined: 15 May 2011
Total Posts: 18684
19 Apr 2012 10:44 PM
You should have named the variable "IsTheMostAwesomePersonEver"
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
19 Apr 2012 11:02 PM
It's divided into functions. The actual calling of the script looks like this:


-----------------------
-- EXECUTE FUNCTIONS --
-----------------------
-- This should be obvious. Each part of the game is divided up into little bits.
-- For example, removing 'SetVIPValues' will entirely disable almost all the VIP stuff.
-- So yeah.


SetupArrowGuides()
FirstTimePlayerStartup()
SetVIPValues()
SetupSwimming()
SetupMainHUD()
SetupHelp()
SetupInventory()--[[
ShipStatSelection()
--SetupChat()
--]]
wait(2)
SetupShop(Workspace.SorcusCity.Shops.Shop, nil)


It's in testing mode right now, so a few things are commented out, and my code to test is at the bottom. :P

It's organized. It's just long. :/

And I don't like 'calling' things. What if the thing you're trying to call gets deleted by a hacker?
Report Abuse
Legend26 is not online. Legend26
Joined: 08 Sep 2008
Total Posts: 10586
19 Apr 2012 11:28 PM
"I'd suggest waiting for Stravant's class system to be added to the RbxUtility library."

Takes too long to wait for a feature from roblox. I made my own.
Report Abuse
xdhunta1774 is not online. xdhunta1774
Joined: 28 Jun 2011
Total Posts: 1112
20 Apr 2012 03:54 AM
why make them local variables?
since their in the main thread, you can just remove the local before them?
Report Abuse
Brandonhare is not online. Brandonhare
Joined: 02 May 2007
Total Posts: 11005
20 Apr 2012 05:00 AM
Efficiency, and it might not be in the main thread.
Generally, you should always use local variables.


Also it's "they're", not "their".

Their: Possessive - "Their boat"
They're: 'They are' 0 "They're going to scotland"
There: "Look over there"
Report Abuse
oxcool1 is not online. oxcool1
Joined: 05 Nov 2009
Total Posts: 15444
20 Apr 2012 05:14 AM
[ Content Deleted ]
Report Abuse
xdhunta1774 is not online. xdhunta1774
Joined: 28 Jun 2011
Total Posts: 1112
20 Apr 2012 05:19 AM
@oxc
how is it faster?
Report Abuse
oxcool1 is not online. oxcool1
Joined: 05 Nov 2009
Total Posts: 15444
20 Apr 2012 05:33 AM
[ Content Deleted ]
Report Abuse
Radioaktiivinen is not online. Radioaktiivinen
Joined: 25 Apr 2009
Total Posts: 18629
20 Apr 2012 06:05 AM
Why dont you just split it into 50 different localscripts like any sane scripter not obsessed with minimizing possible script startup overhead?
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