Here's a tidied version.
Haven't changed any code, just tidied up the tabs and stuff. :>
function LevelSetup()
--SetBackdropColour(8/255,8/255,20/255)
SetBackdropColour(225/255,225/255,225/255)
--Special thanks to Aino, Pilchard123, Alex and Annikk.exe's Guides and Helps, Without them I wouldn't have been inspired to create this custom iPad
--campaign, also obviously, without the Game, none of this would have been possible. The Creator of this level/story is Tomfloria.
--Remember this though when searching through this code, (Aino) :D I am a beginner, and the code might be messy
--But that isn't my concern, if you can clean it up, so that it works exactly the same, then go ahead, and send me
--a PM on the Eufloria Forums at http://www.dyson-game.com/smf/index.php?board=3.0
if IsThIsThisiOS() then
SetMessageDarkMode(true)
end
if IsThIsThisiOS() then
Globals():Get("Asteroids"):Set("RadiusPowerRule",2)
Globals():Get("Asteroids"):Set("SizeFromEnergy",230)
Globals():Get("Asteroids"):Set("SizeFromStrength",230)
Globals():Get("Asteroids"):Set("SizeFromSpeed",240)
Globals():Get("Asteroids"):Set("MinCoreHealth",75)
Globals():Get("Asteroids"):Set("MaxCoreHealth",350)
Globals():Get("Asteroids"):Set("CoreHealthPowerRule",2.5)
Globals():Get("Asteroids"):Set("MinSendDistance",3500)
Globals():Get("Asteroids"):Set("MaxSendDistance",5500)
Globals():Get("Asteroids"):Set("SendPowerRule",2.0)
Globals():Get("Asteroids"):Set("SpawnCap", 40)
Globals():Get("Structures"):Set("LevelDuration1",15)
Globals():Get("Structures"):Set("LevelDuration2",30)
Globals():Get("Structures"):Set("LevelDuration3",60)
Globals():Get("Structures"):Set("LevelDuration4",100)
Globals():Get("Structures"):Set("SpawnTime1",15)
Globals():Get("Structures"):Set("SpawnTime2",12)
Globals():Get("Structures"):Set("SpawnTime3",10)
Globals():Get("Structures"):Set("SpawnTime4",8)
Globals():Get("Flowers"):Set("Available",0)
Globals():Get("Game"):Set("EnemyFactionsMin",0)
Globals():Get("Game"):Set("EnemyFactionsMax",0)
Globals():Get("Game"):Set("MinAsteroidSeparation",1500)
Globals():Get("Game"):Set("MaxAsteroidNeighbourDist",6000)
Globals():Get("Game"):Set("GreysProbability",0)
else
Globals.G.Asteroids=(0)
Globals.G.EnemyFactionsMin=(0)
Globals.G.EnemyFactionsMax=(0)
end
--0 Starting Asteroid
a = AddAsteroidWithAttribs(5000,2000, math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 1
a.TreeCap = 3
s = a:AddDysonTree()
s = a:AddDysonTree()
a:AddSeedlings(30)
a.Moveable = false
--1
a = AddAsteroidWithAttribs(math.random(-4000,9000),math.random(1000,3000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 3
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--2
a = AddAsteroidWithAttribs(math.random(-4000,9000),math.random(1000,3000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 2
a:SetGraceTime(1000)
s = a:AddDysonTree()
s = a:AddDefenseTree()
a:AddSeedlings(math.random(20,40))
a.Moveable = true
a:Hide(1)
--3
a = AddAsteroidWithAttribs(math.random(-4000,15000),math.random(1000,3000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 3
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--4
a = AddAsteroidWithAttribs(math.random(-4000,15000),math.random(1000,3000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 1
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--5
a = AddAsteroidWithAttribs(math.random(-4000,15000),math.random(1000,3000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 3
a.Moveable = true
a:SetGraceTime(0)
a:AddSeedlings(math.random(20,40))
s = a:AddDefenseTree()
s:LevelUp()
s:LevelUp()
s = a:AddDefenseTree()
s:LevelUp()
s:LevelUp()
s = a:AddDysonTree()
s:LevelUp()
s:LevelUp()
a:Hide(1)
--6
a = AddAsteroidWithAttribs(math.random(-10000,-3000),math.random(2000,8000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--7
a = AddAsteroidWithAttribs(math.random(-10000,-3000),math.random(2000,8000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--8
a = AddAsteroidWithAttribs(math.random(-10000,-3000),math.random(2000,8000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(2,4)
a.Moveable = true
a:SetGraceTime(4000)
a:AddSeedlings(math.random(20,40))
a:SetRadius(math.random(500,1000))
s = a:AddDefenseTree()
s:LevelUp()
s:LevelUp()
s = a:AddDysonTree()
s:LevelUp()
s:LevelUp()
a:Hide(1)
--9
a = AddAsteroidWithAttribs(math.random(-10000,-3000),math.random(2000,8000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--10
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:SetGraceTime(200)
s = a:AddDysonTree()
s = a:AddDysonTree()
s = a:AddDefenseTree()
a:AddSeedlings(math.random(20,40))
a:Hide(1)
--11
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 1
a.TreeCap = 0
a:SetProtected(true)
s = a:AddDefenseTree()
s = a:AddDefenseTree()
s = a:AddDefenseTree()
a.Moveable = true
a:Hide(1)
--12
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a:SetGraceTime(50)
s = a:AddDefenseTree()
s = a:AddDefenseTree()
s = a:AddDefenseTree()
a:AddSeedlings(math.random(20,40))
a.Moveable = true
a:Hide(1)
--13
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--14
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(3,4)
a.Moveable = true
a:SetGraceTime(200)
s = a:AddDysonTree()
s = a:AddDysonTree()
s = a:AddDefenseTree()
a:AddSeedlings(math.random(20,40))
a:Hide(1)
--15
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--16
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--17 Enemy Sprawl Asteroid
a = AddAsteroidWithAttribs(math.random(-30000,-25000),math.random(-20000,-10000), math.random(10,10) / 10,math.random(10,10) / 10,math.random(10,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 6
a.Moveable = true
a:Hide(1)
a:SetGraceTime(9999999)
a:AddSeedlings(math.random(40,60))
a:SetRadius(1500)
SetDysonTreeButtonAvailable(true)
SetDefenseTreeButtonAvailable(true)
SetFlowerDefenseButtonAvailable(false)
SetFlowerSeederButtonAvailable(false)
SetTerraformingButtonAvailable(false)
SetBeaconButtonAvailable(false)
if IsThIsThisiOS() then
SetEnemyInfoAvailable(true)
SetCoreInfoAvailable(true)
SetAttribsInfoAvailable(true)
SetSpeedSwitchAvailable(true)
SetSendModeScoutAvailable(true)
SetSendModeUnitsSelectorAvailable(true)
SetSendModeButtonAvailable(true)
SetSendModeHoldAvailable(true)
SetSendModeDragAvailable(true)
else
SetTreeInfoAvailable(true)
SetEnemyInfoAvailable(true)
SetCoreInfoAvailable(true)
SetAttribsInfoAvailable(true)
end
SetCameraPosition(5000,2000)
end
function LevelLogic()
StartLevelLogic()
foundAsteroidbarron11 = 0
GetAsteroid(17):AddDysonTree()
GetAsteroid(17):AddDysonTree()
GetAsteroid(17):AddDysonTree()
GetAsteroid(17):AddDefenseTree()
GetAsteroid(17):AddDefenseTree()
GetAsteroid(17):AddDefenseTree()
CheckConditions()
WaitReal(4)
SetBackdropColour(8/255,8/255,20/255)
if IsThIsThisiOS() then -- Offerings
SelectionClear()
WaitReal(2)
SetLevelDim(true)
Message("-Ordered Strike-", true, 1.0, "Top")
WaitMessage(true)
SetLevelDim(false)
else
MessageBox("-Ordered Strike-")
WaitDialog()
end
if IsThIsThisiOS() then -- Use The Seedlings
WaitReal(1)
Message("Use the seedlings I have given you to conquer this belt.", true, 1.0, "Top")
WaitMessage(true)
else
MessageBox("Use the seedlings I have given you to conquer this belt.")
WaitDialog()
end
while foundAsteroidbarron11 == 0 do
CheckConditions()
coroutine.yield()
end
if IsThisiOS() then -- Beacon
WaitReal(1)
Message("You have found an Unstable Asteroid,~Click on any asteroid you own, and press the {u57345} Beacon Button", true, 1.0, "Top")
SetBeaconButtonAvailable(true)
WaitMessage(true)
else
MessageBox("You have found an Unstable Asteroid,~Click on any asteroid you own, and press the {u57345} Beacon Button")
WaitDialog()
end
if IsThisiOS() then -- Beacon Explination
WaitReal(1)
Message("Then Select the Unstable Asteroid~This will send any newly created seedlings to this Asteroid automatically.", true, 1.0, "Top")
SetBeaconButtonAvailable(true)
WaitMessage(true)
else
MessageBox("Then Select the Unstable Asteroid~This will send any newly created seedlings to this Asteroid automatically.")
WaitDialog()
end
while GameRunning() do
CheckConditions()
coroutine.yield()
end
end
function CheckConditions()
if gameFinished then
return
end
if GetEmpire(1):GetNumOwnedAsteroids() == GetNumAsteroids() then
if IsThisiOS() then
GameOver(true, "")
Message("You successfully taken this belt.~Well Done", true, 1.0, "Centre")
WaitMessage(false)
WaitDialog()
Quit(true)
else
MessageBox("You successfully taken this belt.~Well Done")
GameOver(true, "")
Quit(true)
end
end
if GetEmpire(1).NumDysonTrees == 0 and GetEmpire(1).NumSeedlings == 0 then
if IsThisiOS() then
GameOver(false, "")
Message("You have failed to complete the tasks.", true, 1.0, "Centre")
WaitMessage(false)
WaitDialog()
Quit(false)
else
MessageBox("You have failed to complete the tasks.")
GameOver(false, "")
Quit(false)
end
end
end
function OnAsteroidRevealed(id, owner)
if id == 11 then
foundAsteroidbarron11 = 1
end
end
function IsThIsThisiOS()
if GetScreenWidth() == 2048 or GetScreenWidth() == 1024 then
if GetScreenHeight() == 1536 or GetScreenHeight() == 768 then
return true
else
return false
end
else
return false
end
end
By the way, I've noticed you always specify the background colour like this:
SetBackdropColour(225/255,225/255,225/255)
Do you realise that will just resolve to SetBackdropColour(0.88,0.88,0.88) ?
Because 225 divided by 255 = 0.88
So you'll end up with an amount that is slightly below 1.
Since 0 = no colour and 255 = full colour, you'll end up with a black background. Actually it will be very very very dark grey, but probably indistinguishable from black.
You can also just wrote the command like this:
SetBackdropColour(0,0,0)
That just sets the background to jet black. And it makes the command shorter and tidier. :> There's no need to use those divides..