Discord
Login
Community
DARK THEME

why does this happen?

so sometimes when Im coding I'm doing well the code is perfect but then suddenly it breaks and the console just says

"Variable" not defined defaulting to 0" even tho its clearly defined and it ends up breaking part or the entire game I try to define it in the init function but then it does nothing just removes that specific message how the flip do I fix it when it happens so I don't have to keep asking yall

init = function()
//loading system(Point menu) -------------------------------------------------------
  Points = storage.get("point")
  BaseUPG1 = storage.get("Base_UPG1")
  ValeurClic = storage.get("Point_Gain")
  BaseBoost = storage.get("formula_v1")
  MultiBoost = storage.get("formula_v2")
  MultiUPG1 = storage.get("Multi_UPG1")
  MultiUPG1Lvl = storage.get("Multi_UPG1Lvl")
  MultiUPG2Lvl = storage.get("MultiUPG2_Lvl")
  MultiUPG2 = storage.get("MultiUPG2")
  ExpondentalBoost = storage.get("formula_v3")
//loading system(Prestige) -------------------------------------------------------
  PrestigePoints = storage.get("prestige")
  PrestigeBought = storage.get("PUPG1")
  PrestigeBoostMulti = storage.get("formula_v4")
  PercentClick = storage.get("automation1")
  PrestigeBought2 = storage.get("PUPG2")
  PrestigeBoughtG = storage.get("PUPG3_G")
  PPMultiBoost = storage.get("PFormula_v1")
  PPExpondentalBoost = storage.get("PFormula_v2")
  PrestigeBoughtF = storage.get("PreFeature")
  ExpondentalBoostXP = storage.get("XPFormula_v1")
  MultiBoostXP = storage.get("XPFormula_v2")
  BaseBoostXP = storage.get("XPFormula_v3")
  XP = storage.get("Levels")
  MaxXp = storage.get("MaxXp")
  BoostDisplayPoints = storage.get("xpboostdisplay1")
  PrestigeBought3 = storage.get("PUPG3")
  
  
  if Points == undefined then Points = 0 end
  if BaseUPG1 == undefined then BaseUPG1 = 10 end
  if ValeurClic == undefined then ValeurClic = 1 end
  if MultiUPG1 == undefined then MultiUPG1 = 250 end
  if MultiUPG1Lvl == undefined then MultiUPG1Lvl = 0 end
  if BaseBoost == undefined then BaseBoost = 0 end
  if MultiBoost == undefined then MultiBoost = 1 end
  if MultiUPG2 == undefined then MultiUPG2 = 10000 end
  if MultiUPG2Lvl == undefined then MultiUPG2Lvl = 0 end
  if ExpondentalBoost == undefined then ExpondentalBoost = 1 end
  if PrestigePoints == undefined then PrestigePoints = 0 end
  if PrestigeBought2 == undefined then PrestigeBought2 = 0 end
  if PrestigeBought == undefined then PrestigeBought = 0 end
  if PrestigeBoostMulti == undefined then PrestigeBoostMulti = 1 end
  if PercentClick == undefined then PercentClick = 0 end
  if PrestigeBoughtG == undefined then PrestigeBoughtG = 0 end
  if PPMultiBoost == undefined then PPMultiBoost = 1 end
  if PPExpondentalBoost == undefined then PPExpondentalBoost = 1 end
  if PrestigeBoughtF == undefined then PrestigeBoughtF = 0 end
  if ExpondentalBoostXP == undefined then ExpondentalBoostXP = 1 end
  if BaseBoostXP == undefined then BaseBoostXP = 0 end
  if MultiBoostXP == undefined then MultiBoostXP = 1 end
  if XP == undefined then XP = 0 end
  if MaxXp == undefined then MaxXp = 50 end
  if BoostDisplayPoints == undefined then BoostDisplayPoints = 1000 end
  if PrestigeBought3 == undefined then PrestigeBought3 = 0 end
  
// defining importent values---------------------------------------------  
  stade = ""
  color = "rgb(0, 170, 255)"
  color2 = "rgb(0, 98, 147)"
  colorSub1 = ""
  visual = ""
  PrestigeBought3 = 0
  
  menu = []
  msg = ""
  msgTimer = 0
  saveTimer = 0
  UPGcooldown = 0
  

//(Data object(WIP))--------------------------

//(Point Menu Button function)-----------------------------------
  
  Button = class
    constructor = function(x, y, width, height, id)
      this.x = x
      this.y = y
      this.width = width
      this.height = height
      this.id = id
      this.oldW = width
      this.oldH = height
    end
  end
  
  buttons = []
  buttons.push(new Button(-175, -75, 45, 45, "1"))
  buttons.push(new Button(175, 70, 45, 45, "2"))
  buttons.push(new Button(150, -75, 100, 40, "3")) 
  buttons.push(new Button(150, -30, 100, 40, "4")) 
  buttons.push(new Button(150, 15, 100, 40, "5"))
  buttons.push(new Button(-175, 40, 30, 30, "6"))
  buttons.push(new Button(-120, -75, 45, 45, "7"))
  buttons.push(new Button(-175, 0, 30, 30, "8"))
  buttons.push(new Button(125, 70, 45, 45, "9"))
end
//main code--------------------------------------------------------------
update = function()

    if PercentClick >= 1 then
      Points += (ValeurClic/100/60)*PercentClick
    end
  
  if msgTimer > 0 then msgTimer -= 1 end
  if UPGcooldown > 0 then UPGcooldown -= 1 end
//Auto Save(sub)
    if saveTimer > 0 then saveTimer -= 1
  elsif saveTimer <= 0 then
    storage.set("point", Points)
    storage.set("Base_UPG1", BaseUPG1)
    storage.set("Point_Gain", ValeurClic)
    storage.set("Multi_UPG1", MultiUPG1)
    storage.set("Multi_UPG1Lvl", MultiUPG1Lvl)
    storage.set("formula_v1", BaseBoost)
    storage.set("formula_v2", MultiBoost)
    storage.set("MultiUPG2_Lvl", MultiUPG2Lvl)
    storage.set("MultiUPG2", MultiUPG2)
    storage.set("formula_v3", ExpondentalBoost)
    storage.set("prestige", PrestigePoints)
    storage.set("PUPG1", PrestigeBought)
    storage.set("formula_v4", PrestigeBoostMulti)
    storage.set("automation1", PercentClick)
    storage.set("PUPG2", PrestigeBought2)
    storage.set("PUPG3_G", PrestigeBoughtG)
    storage.set("PFormula_v1", PPMultiBoost)
    storage.set("PFormula_v2", PPExpondentalBoost)
    storage.set("PreFeature", PrestigeBoughtF)
    storage.set("XPFormula_v1", ExpondentalBoostXP)
    storage.set("XPFormula_v2", MultiBoostXP)
    storage.set("XPFormula_v3", BaseBoostXP)
    storage.set("Levels", XP)
    storage.set("MaxXp", MaxXp)
    storage.set("xpboostdisplay1", BoostDisplayPoints)
    storage.set("PUPG3", PrestigeBought3)
    saveTimer = 300
  end
  
//formatic systems
  ValeurClic = floor((((1 + BaseBoost) * MultiBoost) * PrestigeBoostMulti) * PrestigePointToPointFormatic1) ^ ExpondentalBoost
  PrestigeGain = floor((Points/1e6)^(1/3) * PPMultiBoost) ^ PPExpondentalBoost
  PointBoostXP = (log(Points)^(1/3))
  XPGain = (((1 + BaseBoostXP) * MultiBoostXP) * PointBoostXP) ^ ExpondentalBoostXP
  PrestigePointToPointFormatic1 = log(PrestigePoints^(1/2.3025850929940456*(PrestigeBought3*2))) + 1 
//Point Menu Buttons------------------------------------------------------  
  for b in buttons
    local targetW = b.width
    local targetH = b.height
    
    if checkRectMouseHover(b.x, b.y, b.width, b.height) then
      targetW = b.width + 15
      targetH = b.height + 15
    
      
      if b.id == "2" and stade == "" and mouse.press then 
        Points += ValeurClic 
      end
      
      if b.id == "1" and stade == "" and mouse.press then
        storage.set("point", Points)
        storage.set("Base_UPG1", BaseUPG1)
        storage.set("Point_Gain", ValeurClic)
        storage.set("Multi_UPG1", MultiUPG1)
        storage.set("Multi_UPG1Lvl", MultiUPG1Lvl)
        storage.set("formula_v1", BaseBoost)
        storage.set("formula_v2", MultiBoost)
        storage.set("MultiUPG2_Lvl", MultiUPG2Lvl)
        storage.set("MultiUPG2", MultiUPG2)
        storage.set("formula_v3", ExpondentalBoost)
        storage.set("prestige", PrestigePoints)
        storage.set("PUPG1", PrestigeBought)
        storage.set("formula_v4", PrestigeBoostMulti)
        storage.set("Automation1", PercentClick)
        storage.set("PUPG2", PrestigeBought2)
        storage.set("PFormula_v1", PPMultiBoost)
        storage.set("PFormula_v2", PPExpondentalBoost)
        storage.set("PUPG3_G", PrestigeBoughtG)
        storage.set("PreFeature", PrestigeBoughtF)
        storage.set("XPFormula_v1", ExpondentalBoostXP)
        storage.set("XPFormula_v2", MultiBoostXP)
        storage.set("XPFormula_v3", BaseBoostXP)
        storage.set("Levels", XP)
        storage.set("MaxXp", MaxXp)
        storage.set("xpboostdisplay1", BoostDisplayPoints)
        storage.set("PUPG3", PrestigeBought3)
        msg = "GAME SAVED!"
        msgTimer = 120
      end

      if b.id == "3" and stade == "" and mouse.press then 
        if Points >= BaseUPG1 then
          Points -= BaseUPG1
          BaseBoost += 1
          BaseUPG1 = floor(BaseUPG1 * 1.25)
          msg = "UPGRADE BOUGHT!"
          msgTimer = 120
        end
      end
      
       if b.id == "4" and stade == "" and BaseUPG1 >= 12 and mouse.press then
        if Points >= MultiUPG1 and MultiUPG1Lvl < 50 then
          Points -= MultiUPG1
          MultiUPG1Lvl += 1
          MultiBoost = (MultiBoost * 1.5)
          if MultiUPG1 < 1e6 then
            MultiUPG1 *= 2
          end
          if MultiUPG1 >= 1e6 then
            MultiUPG1 *= 5
          end
        end
      end
    
        if b.id == "5" and stade == "" and MultiUPG1Lvl >= 1 and mouse.press then
          if Points >= MultiUPG2 and MultiUPG2Lvl < 10 then
            Points -= MultiUPG2
            MultiUPG2Lvl += 1
            MultiBoost = (MultiBoost * 2)
            if MultiUPG2 < 1e6 then
              MultiUPG2 *= 10
            end
            if MultiUPG2 >= 1e6 then
              MultiUPG2 *= 25
            end
          end
        end

            if b.id == "6" and stade == "" and MultiUPG2Lvl and mouse.press then
              stade = "prestige_mode"
        end
          
          if b.id == "7" and stade == "" and mouse.press then
        storage.set("point", 0)
        storage.set("Base_UPG1", 0)
        storage.set("Point_Gain", 0)
        storage.set("Multi_UPG1", 0)
        storage.set("Multi_UPG1Lvl", 0)
        storage.set("formula_v1", 0)
        storage.set("formula_v2", 1)
        storage.set("MultiUPG2_Lvl", 0)
        storage.set("MultiUPG2", 0)
        storage.set("formula_v3", 1)
        storage.set("prestige", 0)
        storage.set("PUPG1", 0)
        storage.set("formula_v4", 1)
        storage.set("Automation1", 0)
        storage.set("PUPG2", 0)
        storage.set("PFormula_v1", 1)
        storage.set("PFormula_v2", 1)
        storage.set("PUPG3_G", 0)
        storage.set("PreFeature", 0)
        storage.set("XPFormula_v1", 1)
        storage.set("XPFormula_v2", 1)
        storage.set("XPFormula_v3", 0)
        storage.set("Levels", 0)
        storage.set("MaxXp", 50)
        storage.set("xpboostdisplay1", 1000)
        storage.set("PUPG3", 0)
        Points = 0
        BaseUPG1 = 10
        BaseBoost = 0
        MultiBoost = 1
        MultiUPG1 = 250
        MultiUPG1Lvl = 0
        MultiUPG2Lvl = 0
        MultiUPG2 = 10000
        ExpondentalBoost = 1
        PrestigePoints = 0 
        PrestigeBought = 0
        PrestigeBoostMulti = 1
        PercentClick = 0
        PrestigeBought2 = 0
        PPMultiBoost = 1
        PPExpondentalBoost = 1
        PrestigeBoughtG = 0
        PrestigeBoughtF = 0
        ExpondentalBoostXP = 1
        BaseBoostXP = 0
        MultiBoostXP = 1
        XP = 0
        MaxXp = 50
        BoostDisplayPoints = 1000
        PrestigeBought3 = 0
        msg = "GAME RESET!"
        msgTimer = 120
      end
        
      if b.id == "8" and stade == "" and PrestigeBoughtF == 1 and mouse.press then
        stade = "Level"
      end
      
      if b.id == "9" and stade == "" and mouse.press and UPGcooldown < 1 then
        stade = "Guide"
      end
    end
//Prestige Menu Buttons--------------------------------------------------     
 
  if stade == "prestige_mode" then
    color = "rgb(0,26,255)"
    visual = "prestige"
    colorSub1 = "rgb(0,13,127)" 
    color2 = "rgb(0,26,255)"
    button1 = "prestige_reset"
    if mouse.pressed and mouse.y < -30 and mouse.y > -70 and abs(mouse.x) < 75 then
      prestige()
    end
    if mouse.pressed and mouse.y < 15 and mouse.y > -15 and mouse.x < 165 and mouse.x > 135 then
      Xbutton()
    end
    if mouse.pressed and mouse.y < -35 and mouse.y > -65 and mouse.x < -122.5 and mouse.x > -187.5 then
      UPGTree1()
    end
  
   

  elsif stade == "" then
    color = "rgb(85,198,255)"
    visual = ""
    
 //Guide Tab-----------------------------------------------------------------------------------------------   
  elsif stade == "Guide" then
    color = "rgb(255, 255, 200)"
    if mouse.pressed and mouse.y < 55 and mouse.y > 45 and mouse.x < 130 and mouse.x > 120 then
      Xbutton()
    end
    if mouse.pressed and mouse.y < 85 and mouse.y > 65 and mouse.x < -90 and mouse.x > -150 then
      GuideTabPoints()
    end
    if mouse.pressed and mouse.y < 60 and mouse.y > 40 and mouse.x < -90 and mouse.x > -150 then
      GuideTabPrestige()
    end
    
  elsif stade == "Guide_Points" then
    color = "rgb(200, 255, 220)"
    visual = "point_coin"
    if mouse.pressed and mouse.y < 10 and mouse.y > -10 and mouse.x < -115 and mouse.x > -135 then
      ReturnToGuide()
  
  elsif stade == "Guide_Prestige" then
    color = "rgb(200, 255, 220)"
    visual = "prestige_coin"
    if mouse.pressed and mouse.y < 10 and mouse.y > -10 and mouse.x < -115 and mouse.x > -135 then
      ReturnToGuide()
    end
    
  
    
    

    
    
    
    
    
//Prestige Upgrade tree buttons-----------------------------------------
  elsif stade == "UPG_tree_prestige" then
    color = "rgb(0,120,150)"
    color2 = "rgb(0,0,0)"
    visual = "prestige_upgtree"
    if mouse.pressed and PrestigeBought < 1 and mouse.y < -40 and mouse.y > -80 and abs(mouse.x) < 22.5 then
      PreTree1()
    end
    if mouse.pressed and mouse.y < 55 and mouse.y > 45 and mouse.x < 130 and mouse.x > 120 then
      Xbutton()
    end
    if mouse.pressed and PrestigeBought >= 1 and PrestigeBought2 < 1 and mouse.y < 10 and mouse.y > -30 and mouse.x < 72.5 and mouse.x > 37.5 then
      PreTree2()
    end
    if mouse.pressed and PrestigeBought >= 1 and mouse.y < 10 and mouse.y > -30 and mouse.x < -37.5 and mouse.x > -72.5 then
      PreTreeG1()
    end
    if mouse.pressed and PrestigeBought2 >= 1 and PrestigeBoughtG >= 1 and PrestigeBoughtF < 1 and mouse.y < 60 and mouse.y > 20 and abs(mouse.x < 22.5) then
      PreTreeF1()
    end
    if mouse.press and UPGcooldown < 1 and PrestigeBoughtF == 1 and mouse.y < 15 and mouse.y > -15 and mouse.x < 190 and mouse.x > 170 then
      NextUPGTREETab()
    end
    
  elsif stade == "UPG_tree_prestige2" then
    color = "rgb(0,120,150)"
    color2 = "rgb(0,0,0)"
    visual = "prestige_upgtree"
    if mouse.pressed and mouse.y < 55 and mouse.y > 45 and mouse.x < 130 and mouse.x > 120 then
      Xbutton()
    end
    if mouse.press and UPGcooldown < 1 and PrestigeBoughtF == 1 and mouse.y < 15 and mouse.y > -15 and mouse.x < -170 and mouse.x > -190 then
      BackUPGTREETab()
    end
    if mouse.pressed and PrestigeBought3 < 1 and mouse.y < -40 and mouse.y > -80 and abs(mouse.x) < 22.5 then
      PreTree3()
    end
  end
    
//Golden Prestige Upgrade functions----------------------------------
  if stade == "GoldUPG1" then
    color = "rgb(200,200,200)"
    if mouse.press and PrestigeBoughtG == 0 and mouse.y < -35 and mouse.y > -65 and mouse.x < 10 and mouse.x > -110 then
      PreTreeG1_Lvl1()
    elsif mouse.press and PrestigeBoughtG == 1 and mouse.y < -35 and mouse.y > -65 and mouse.x < 10 and mouse.x > -110 then
      PreTreeG1_Lvl2()
    elsif mouse.press and PrestigeBoughtG == 2 and mouse.y < -35 and mouse.y > -65 and mouse.x < 10 and mouse.x > -110 then
      PreTreeG1_Lvl3()
    elsif mouse.pressed and mouse.y < -40 and mouse.y > -60 and mouse.x < 80 and mouse.x > 20 then
      XbuttonTree()
    end
  end
  
//Level  button functions-------------------------------------------------------------  
    if stade == "Level" then
      color = "green"
      visual = "level_menu"
      if mouse.press and PrestigeBoughtF == 1 and mouse.y < 10 and mouse.y > -10 and abs(mouse.x) < 50 then
        XP += XPGain/8
      end
      if XP >= MaxXp then
        LevelUp()
      end
      if mouse.pressed and mouse.y < 15 and mouse.y > -15 and mouse.x < 165 and mouse.x > 135 then
        Xbutton()
      end
    end
  
  


            

  
    
    
    
    

    
    
  

  
  
  
//button visuals-------------------------------------------------------
      if b.oldW < targetW then b.oldW += 1
      elsif b.oldW > targetW then b.oldW -= 1
      end
    
      if b.oldH < targetH then b.oldH += 1
      elsif b.oldH > targetH then b.oldH -= 1
      end
    end
  end
  
//Point Menu Button Visuals--------------------------------------------------------------------
    draw = function() 
      if stade == "" then
        screen.clear("rgb(85,198,255)")
        screen.drawText("POINTS: " + abbreviate(Points),  -150, 75, 20, "Black")
        screen.drawText(abbreviate(ValeurClic), -10, 50, 15, "")
        screen.drawText("=", -50, 50, 15, "")
        screen.drawText("Gain Per Click", -100, 50, 15, "")
      if PercentClick > 0 then 
        screen.drawText(abbreviate(ValeurClic/100*PercentClick), 10, 30, 15, "")
        screen.drawText("=", -40, 30, 15, "")
        screen.drawText("Gain Per Second", -100, 30, 15, "")
      end
    

      
  if msgTimer > 0 then
    screen.drawText(msg, 0, 75, 15, "rgb(255,255,255)")
  end
  
  for b in buttons
    if b.id == "2" then
      screen.drawSprite("point_upgrades", b.x, b.y, b.oldW, b.oldH)
    elsif b.id == "1" then
      screen.drawSprite("save", b.x, b.y, b.oldW, b.oldH)
    elsif b.id == "3" then
      screen.fillRect(b.x, b.y, b.oldW, b.oldH, "orange")
      screen.drawRect(b.x, b.y, b.oldW, b.oldH, "white")
      screen.drawText("+1 BaseGain: " + abbreviate(BaseUPG1), b.x, b.y, 12, "white")
    elsif b.id == "4" and BaseUPG1 >= 12 and MultiUPG1Lvl < 50 then
      screen.fillRect(b.x, b.y, b.oldW, b.oldH, "orange")
      screen.drawRect(b.x, b.y, b.oldW, b.oldH, "white")
      screen.drawText("1.5x Multiplier: " + abbreviate(MultiUPG1), b.x, b.y, 12, "white")
    elsif b.id == "5" and MultiUPG1 >= 500 and MultiUPG2Lvl < 10 then
      screen.fillRect(b.x, b.y, b.oldW, b.oldH, "orange")
      screen.drawRect(b.x, b.y, b.oldW, b.oldH, "white")
      screen.drawText("2x Multiplier:" + abbreviate(MultiUPG2), b.x, b.y, 12, "white")
    elsif b.id == "6" and MultiUPG2 >= 100000  then
      screen.drawSprite("prestige_menu", b.x, b.y, b.oldW, b.oldH)
    elsif b.id == "7" then
      screen.drawSprite("reset", b.x, b.y, b.oldW, b.oldH)
    elsif b.id == "8" and PrestigeBoughtF == 1 then
      screen.drawSprite("levels", b.x, b.y, b.oldW, b.oldH)
    elsif b.id == "9" then
      screen.drawSprite("guide", b.x, b.y, b.oldW, b.oldH)
    end
  end
//Prestige(Major)----------------------------------------------------------------------------------------------
//          |
//          |
//          |
//          V

   
//Prestige Menu Visuals-----------------------------------------------------------------------
    elsif stade == "prestige_mode" then
          screen.clear(color)
          text = "Prestige for Prestige points to speed up progression"
          subText = "1M Points required to prestige"
        screen.drawSprite(visual,0,0, 425, 200)
        screen.drawText(text,0,50,15,color2)
        screen.drawText(subText,0,20,15,colorSub1)
        screen.fillRoundRect(0, -50, 150, 40, 5, "rgb(40,120,100)")
        if Points < 1e6 then
          screen.drawText("Prestige (1.000M)", 0, -50, 15, "#FFF")
        end
        if Points >= 1e6 then
          screen.drawText(("Prestige for: " + abbreviate(PrestigeGain) + " PP"), 0, -50, 10, "#FFF")
        end
        screen.fillRoundRect(150, 0, 30, 30, 30, "rgb(200,50,50)")
        screen.drawText("X", 151, 0, 25, "#FFF")
        screen.fillRoundRect(-150, -50, 75, 30, 30, "rgb(40,120,100")
        screen.drawText("Upgrade Tree", -150, -50, 10, '#FFF')
        screen.drawText("Formula: (Points/1M)^(1/3)", 0 ,-80, 20, "Grey")
    
//Prestige Upgrade Tree Visual------------------------------------------------------------------------ 
    elsif stade == "UPG_tree_prestige" then
      screen.clear(color)
      text = "Prestige UPG Tree (tab1)"
      screen.drawSprite(visual,0,0,425,200)
      screen.drawText(text,-70,85,15,color2)
      screen.fillRoundRect(0, -60, 45, 40, 10,"rgb(40,40,255")
      screen.drawText("3x Points", 0 , -50, 10, "black")
      screen.drawText(("Prestige Points: " + abbreviate(PrestigePoints)), 90, 85, 10, "black")
      screen.fillRoundRect(125, 50, 10, 10, 30, "rgb(200,50,50)")
      screen.drawText("X", 125.5, 50, 9, "#FFF")
      if PrestigeBought == 0 then
        screen.drawText("PP: 1", 0, -65, 10, "black")
      end
      if PrestigeBought == 1 then
        screen.drawText("Bought!", 0, -65, 10, "black")
        screen.fillRoundRect(50,-10, 45, 40, 10, "rgb(40,40,255)")
        screen.fillRoundRect(-50,-10, 45, 40, 10, "rgb(255,255,0)")
        screen.drawRoundRect(-50, -10, 45, 40, 10, "rgb(40,40,255")
        screen.drawRoundRect(-50, -10, 44, 39, 10, "rgb(40,40,255")
        screen.drawRoundRect(-50, -10, 43, 38, 10, "rgb(40,40,255")
        screen.setLineWidth(5)
        screen.drawLine(20, -45, 50, -30, "Black")
        screen.drawLine(-20, -45, -50, -30, "Black")
        screen.drawText("2.25x Points", 50, -5, 8.5, "black")
        screen.drawText("Auto Clicks", -50, -5, 8.5, "black")
        if PrestigeBought2 == 0 then
          screen.drawText("PP: 3", 50, -17.5, 10, "black")
        end
        if PrestigeBought2 == 1 then
          screen.drawText("Bought!", 50, -17.5, 10, "black")
        end
        if PrestigeBoughtG < 3 then
          screen.drawText(("Lvl: " + PrestigeBoughtG + "/3"), -50, -15, 10, "black") 
        end
        if PrestigeBoughtG == 3 then
          screen.drawText("Maxed!", -50,-15,10, "black")
        end
        if PrestigeBoughtG > 0 and PrestigeBought2 > 0 then
          screen.fillRoundRect(0, 40, 45, 40, 10, "rgb(50,255,0)")
          screen.drawText("Unlock", -0, 52.5, 8.5, "black")
          if PrestigeBoughtF < 1 then
            screen.drawText("PP: 50", 0, 30, 10, "black")
          end
          if PrestigeBoughtF == 1 then
            screen.drawText("Bought!", 0, 30, 10, "black")
            screen.fillRect(180, 0, 30,20, "white")
            screen.drawText(">", 182.5, 0, 20, "black")
          end
          screen.drawText("Levels", -0, 42.5, 8.5, "black")
          screen.setLineWidth(2)
          screen.drawRoundRect(0,40,45,40,10,"Blue")  
          screen.setLineWidth(5)
          screen.drawLine(50, 10, 20, 40, "black")
          screen.drawLine(-50, 10, -20, 40, "black")
        end
      end
    
    elsif stade == "UPG_tree_prestige2" then
      screen.clear(color)
      text = "Prestige UPG Tree (tab2)"
      screen.drawSprite(visual,0,0,425,200)
      screen.drawText(text,-70,85,15,color2)
      screen.fillRoundRect(125, 50, 10, 10, 30, "rgb(200,50,50)")
      screen.drawText("X", 125.5, 50, 9, "#FFF")
      screen.fillRect(-180, 0, 30,20, "white")
      screen.drawText("<", -180, 0, 20, "black")
      screen.fillRoundRect(0, -60, 45, 40, 10,"rgb(40,40,255")
      screen.fillRoundRect(75, -60, 45, 40, 10,"rgb(40,40,255")
      screen.fillRoundRect(-75, -60, 45, 40, 10,"rgb(40,40,255")
      screen.drawText("Prestige Points", 0, -50, 7, "black")
      screen.drawText("Boosts Points", 0, -57.5, 7, "black")
      if PrestigeBought3 == 0 then
        screen.drawText("PP: 250", 0, -70, 10, "black")
      elsif PrestigeBought3 == 1 then
        screen.drawText(("X " + (floor(PrestigePointToPointFormatic1*1000)/1000)), 0, -70, 10, "black")
      end
    end
    
    
    

//Golden Upgrade Prestige Visuals---------------------------------------------------------------------------------------      
      if stade == "GoldUPG1" then
        screen.clear(color)
        screen.drawText("Lvl 1: 1+ CPS, 3x Points, 1.5x PP", 0,40,10,"black")
        screen.drawRect(0,0,420,195,"black")
        screen.drawRect(0,30,300, 50,"black")
        screen.drawText("Lvl 2: 1+ CPS, 2x Points, 1.25x PP", 0,30,10,"black")
        screen.drawText("Lvl 3: 1+ CPS", 0,20,10,"black")
        screen.fillRoundRect(-50,-50,120,30,5 "Green")
        screen.drawText("Auto Clicks", 0 ,75, 30, "Black")
        screen.fillRoundRect(50,-50,60,20,5,"rgb(200,0,0")
        screen.drawText("Back", 50, -50, 15, "black")
        if PrestigeBoughtG == 0 then
          screen.drawText("5: Prestige Points", -50, -50, 12.5, "black")
        end
        if PrestigeBoughtG == 1 then
          screen.drawText("15: Prestige Points", -50, -50, 12.5, "black")
        end
        if PrestigeBoughtG == 2 then
          screen.drawText("50: Prestige Points", -50, -50, 12.5, "black")
        end
        if PrestigeBoughtG == 3 then
          screen.drawText("Maxed", -50, -50, 12.5, "black")
        end
      end

//Level Menu visuals----------------------------------------------------------------------------      
      if stade == "Level" then
        screen.clear(color)
        screen.drawSprite(visual, 0, 0, 425, 200)
        screen.drawText(("XP: " + abbreviate(XP) + "/" + abbreviate(MaxXp)), 0, 50, 20, "black")
        screen.fillRoundRect(0, 0, 100, 20, 4, "rgb(200,200,200)")
        screen.drawText("XP", 0, 1, 20, "Black")
        screen.fillRoundRect(150, 0, 30, 30, 30, "rgb(200,50,50)")
        screen.drawText("X", 151, 0, 25, "#FFF")
        screen.drawText("points Multiplyed by 1.5 each level", 100, 30, 10, "black")
        screen.drawText("XP boosted by points by " + floor(PointBoostXP*1000) / 1000, 0, -30, 10, "rgb(0,100,0)")
        screen.drawText("Formula: log(Points)^(1/3)", 0 ,-60, 20, "grey")
        if BoostDisplayPoints > 1000 and BoostDisplayPoints < 10000 then
          screen.drawText(("Points are multiplyed by " + (BoostDisplayPoints/1000)), -100 ,30 ,10, "rgb(0,200,200)")
        end
        if BoostDisplayPoints > 10000 then
          screen.drawText(("Points are multiplyed by " + abbreviate(BoostDisplayPoints/1000)), -100, 30, 10, "rgb(0,200,200)")
        end
      end
//Guide Visuals--------------------------------------------------------------------------     
      if stade == "Guide" then
        screen.clear(color)
        screen.drawRect(0,0,325,190 "black")
        screen.fillRoundRect(-120, 75, 60, 20, 5, "rgb(200,200,200")
        screen.drawText("Points", -120, 75, 15, "black")
        screen.fillRoundRect(125, 50, 10, 10, 30, "rgb(200,50,50)")
        screen.drawText("X", 125.5, 50, 9, "#FFF")
        if MultiUPG2Lvl > 0 then
          screen.fillRoundRect(-120, 50, 60, 20, 5, "rgb(200,200,200")
          screen.fillRoundRect(-120, 25, 60, 20, 5, "rgb(200,200,200")
          screen.drawText("Prestige", -120, 50, 15, "black")
          screen.drawText("UPG Tree", -120, 25, 13, "black")
        end
        if PrestigeBoughtF > 0 then
          screen.fillRoundRect(-120, 0, 60, 20, 5, "rgb(200,200,200")
          screen.drawText("Levels", -120, 0, 15, "black")
        end
      end
      
      if stade == "Guide_Points" then
        screen.clear(color)
        screen.drawSprite(visual, -125 ,57.5, 50, 50)
        screen.drawRect(0,0,325,190 "black")
        screen.drawRect(-125,57.5,65,65 "black")
        screen.drawRect(50,0,200,170 "black")
        screen.drawText("The Point Menu is stage 1 of the game consisting of a few-", 50, 75, 7.5, "black")
        screen.drawText("-Upgrades, The Clicker, and the first main currency Points.", 50, 65, 7.5, "black")
        screen.drawText("------Points and Upgrades------", 50, 45, 15, "black")
        screen.drawText("To gain Points click the red button and to buy upgrades-", 50, 25, 7.5, "black")
        screen.drawText("get enough points you can click the upgrades once you do", 50, 15, 7.5, "black")
        screen.drawText("Its that simple", 50, 0, 10, "black")
        screen.drawText("1M Points for next guide", 50, -15, 15, "black")
        screen.drawText("--------------------------------", 50, -7.5, 15, "black")
        screen.fillRoundRect(-125, 0, 20, 20, 30, "rgb(200,50,50)")
        screen.drawText("X", -124, 0, 18, "#FFF")
      end
    end
  end

also it just broke the post prestige system the pre prestige system is fine

Variables in microscript are never undefined so you might as well remove this:

if Points == undefined then Points = 0 end
  if BaseUPG1 == undefined then BaseUPG1 = 10 end
  if ValeurClic == undefined then ValeurClic = 1 end
  if MultiUPG1 == undefined then MultiUPG1 = 250 end
  if MultiUPG1Lvl == undefined then MultiUPG1Lvl = 0 end
  if BaseBoost == undefined then BaseBoost = 0 end
  if MultiBoost == undefined then MultiBoost = 1 end
  if MultiUPG2 == undefined then MultiUPG2 = 10000 end
  if MultiUPG2Lvl == undefined then MultiUPG2Lvl = 0 end
  if ExpondentalBoost == undefined then ExpondentalBoost = 1 end
  if PrestigePoints == undefined then PrestigePoints = 0 end
  if PrestigeBought2 == undefined then PrestigeBought2 = 0 end
  if PrestigeBought == undefined then PrestigeBought = 0 end
  if PrestigeBoostMulti == undefined then PrestigeBoostMulti = 1 end
  if PercentClick == undefined then PercentClick = 0 end
  if PrestigeBoughtG == undefined then PrestigeBoughtG = 0 end
  if PPMultiBoost == undefined then PPMultiBoost = 1 end
  if PPExpondentalBoost == undefined then PPExpondentalBoost = 1 end
  if PrestigeBoughtF == undefined then PrestigeBoughtF = 0 end
  if ExpondentalBoostXP == undefined then ExpondentalBoostXP = 1 end
  if BaseBoostXP == undefined then BaseBoostXP = 0 end
  if MultiBoostXP == undefined then MultiBoostXP = 1 end
  if XP == undefined then XP = 0 end
  if MaxXp == undefined then MaxXp = 50 end
  if BoostDisplayPoints == undefined then BoostDisplayPoints = 1000 end
  if PrestigeBought3 == undefined then PrestigeBought3 = 0 end

when variables are undefined they default to 0 also your problem is if you ever keep the program running while coding it could show error messages because its reacting live. additionally i enjoy helping people with their code so its ok if you keep asking for help

undefined also isn't a value, so microScript tries to access a variable called undefined instead.

I'm assuming what you mean by the program is that I should turn it off for a while and code in a few hours

great I was trying to fix it myself and I ended up butchering my game reversing the changes wont work

init = function()
//loading system(Point menu) -------------------------------------------------------
  Points = storage.get("point")
  BaseUPG1 = storage.get("Base_UPG1")
  ValeurClic = storage.get("Point_Gain")
  BaseBoost = storage.get("formula_v1")
  MultiBoost = storage.get("formula_v2")
  MultiUPG1 = storage.get("Multi_UPG1")
  MultiUPG1Lvl = storage.get("Multi_UPG1Lvl")
  MultiUPG2Lvl = storage.get("MultiUPG2_Lvl")
  MultiUPG2 = storage.get("MultiUPG2")
  ExpondentalBoost = storage.get("formula_v3")
//loading system(Prestige) -------------------------------------------------------
  PrestigePoints = storage.get("prestige")
  PrestigeBought = storage.get("PUPG1")
  PrestigeBoostMulti = storage.get("formula_v4")
  PercentClick = storage.get("automation1")
  PrestigeBought2 = storage.get("PUPG2")
  PrestigeBoughtG = storage.get("PUPG3_G")
  PPMultiBoost = storage.get("PFormula_v1")
  PPExpondentalBoost = storage.get("PFormula_v2")
  PrestigeBoughtF = storage.get("PreFeature")
  ExpondentalBoostXP = storage.get("XPFormula_v1")
  MultiBoostXP = storage.get("XPFormula_v2")
  BaseBoostXP = storage.get("XPFormula_v3")
  XP = storage.get("Levels")
  MaxXp = storage.get("MaxXp")
  BoostDisplayPoints = storage.get("xpboostdisplay1")
  PrestigeBought3 = storage.get("PUPG3")
  
  
// defining importent values---------------------------------------------  
  stade = ""
  color = "rgb(0, 170, 255)"
  color2 = "rgb(0, 98, 147)"
  colorSub1 = ""
  visual = ""
  
  menu = []
  msg = ""
  msgTimer = 0
  saveTimer = 0
  UPGcooldown = 0
  PrestigePointToPointFormatic1 = 1
  

//(Data object(WIP))--------------------------

//(Point Menu Button function)-----------------------------------
  
  Button = class
    constructor = function(x, y, width, height, id)
      this.x = x
      this.y = y
      this.width = width
      this.height = height
      this.id = id
      this.oldW = width
      this.oldH = height
    end
  end
  
  buttons = []
  buttons.push(new Button(-175, -75, 45, 45, "1"))
  buttons.push(new Button(175, 70, 45, 45, "2"))
  buttons.push(new Button(150, -75, 100, 40, "3")) 
  buttons.push(new Button(150, -30, 100, 40, "4")) 
  buttons.push(new Button(150, 15, 100, 40, "5"))
  buttons.push(new Button(-175, 40, 30, 30, "6"))
  buttons.push(new Button(-120, -75, 45, 45, "7"))
  buttons.push(new Button(-175, 0, 30, 30, "8"))
  buttons.push(new Button(125, 70, 45, 45, "9"))
end
//main code--------------------------------------------------------------
update = function()

    if PercentClick >= 1 then
      Points += (ValeurClic/100/60)*PercentClick
    end
  
  if msgTimer > 0 then msgTimer -= 1 end
  if UPGcooldown > 0 then UPGcooldown -= 1 end
//Auto Save(sub)
    if saveTimer > 0 then saveTimer -= 1
  elsif saveTimer <= 0 then
    storage.set("point", Points)
    storage.set("Base_UPG1", BaseUPG1)
    storage.set("Point_Gain", ValeurClic)
    storage.set("Multi_UPG1", MultiUPG1)
    storage.set("Multi_UPG1Lvl", MultiUPG1Lvl)
    storage.set("formula_v1", BaseBoost)
    storage.set("formula_v2", MultiBoost)
    storage.set("MultiUPG2_Lvl", MultiUPG2Lvl)
    storage.set("MultiUPG2", MultiUPG2)
    storage.set("formula_v3", ExpondentalBoost)
    storage.set("prestige", PrestigePoints)
    storage.set("PUPG1", PrestigeBought)
    storage.set("formula_v4", PrestigeBoostMulti)
    storage.set("automation1", PercentClick)
    storage.set("PUPG2", PrestigeBought2)
    storage.set("PUPG3_G", PrestigeBoughtG)
    storage.set("PFormula_v1", PPMultiBoost)
    storage.set("PFormula_v2", PPExpondentalBoost)
    storage.set("PreFeature", PrestigeBoughtF)
    storage.set("XPFormula_v1", ExpondentalBoostXP)
    storage.set("XPFormula_v2", MultiBoostXP)
    storage.set("XPFormula_v3", BaseBoostXP)
    storage.set("Levels", XP)
    storage.set("MaxXp", MaxXp)
    storage.set("xpboostdisplay1", BoostDisplayPoints)
    storage.set("PUPG3", PrestigeBought3)
    saveTimer = 300
  end
  
//formatic systems
  ValeurClic = floor((((1 + BaseBoost) * MultiBoost) * PrestigeBoostMulti) * PrestigePointToPointFormatic1) ^ ExpondentalBoost
  PrestigeGain = floor((Points/1e6)^(1/3) * PPMultiBoost) ^ PPExpondentalBoost
  PointBoostXP = (log(Points)^(1/3))
  XPGain = (((1 + BaseBoostXP) * MultiBoostXP) * PointBoostXP) ^ ExpondentalBoostXP
  PrestigePointToPointFormatic1 = log(PrestigePoints^(1/2.3025850929940456*(PrestigeBought3*2))) + 1 
//Point Menu Buttons------------------------------------------------------  
  for b in buttons
    local targetW = b.width
    local targetH = b.height
    
    if checkRectMouseHover(b.x, b.y, b.width, b.height) then
      targetW = b.width + 15
      targetH = b.height + 15
    
      
      if b.id == "2" and stade == "" and mouse.press then 
        Points += ValeurClic 
      end
      
      if b.id == "1" and stade == "" and mouse.press then
        storage.set("point", Points)
        storage.set("Base_UPG1", BaseUPG1)
        storage.set("Point_Gain", ValeurClic)
        storage.set("Multi_UPG1", MultiUPG1)
        storage.set("Multi_UPG1Lvl", MultiUPG1Lvl)
        storage.set("formula_v1", BaseBoost)
        storage.set("formula_v2", MultiBoost)
        storage.set("MultiUPG2_Lvl", MultiUPG2Lvl)
        storage.set("MultiUPG2", MultiUPG2)
        storage.set("formula_v3", ExpondentalBoost)
        storage.set("prestige", PrestigePoints)
        storage.set("PUPG1", PrestigeBought)
        storage.set("formula_v4", PrestigeBoostMulti)
        storage.set("Automation1", PercentClick)
        storage.set("PUPG2", PrestigeBought2)
        storage.set("PFormula_v1", PPMultiBoost)
        storage.set("PFormula_v2", PPExpondentalBoost)
        storage.set("PUPG3_G", PrestigeBoughtG)
        storage.set("PreFeature", PrestigeBoughtF)
        storage.set("XPFormula_v1", ExpondentalBoostXP)
        storage.set("XPFormula_v2", MultiBoostXP)
        storage.set("XPFormula_v3", BaseBoostXP)
        storage.set("Levels", XP)
        storage.set("MaxXp", MaxXp)
        storage.set("xpboostdisplay1", BoostDisplayPoints)
        storage.set("PUPG3", PrestigeBought3)
        msg = "GAME SAVED!"
        msgTimer = 120
      end

      if b.id == "3" and stade == "" and mouse.press then 
        if Points >= BaseUPG1 then
          Points -= BaseUPG1
          BaseBoost += 1
          BaseUPG1 = floor(BaseUPG1 * 1.25)
          msg = "UPGRADE BOUGHT!"
          msgTimer = 120
        end
      end
      
       if b.id == "4" and stade == "" and BaseUPG1 >= 12 and mouse.press then
        if Points >= MultiUPG1 and MultiUPG1Lvl < 50 then
          Points -= MultiUPG1
          MultiUPG1Lvl += 1
          MultiBoost = (MultiBoost * 1.5)
          if MultiUPG1 < 1e6 then
            MultiUPG1 *= 2
          end
          if MultiUPG1 >= 1e6 then
            MultiUPG1 *= 5
          end
        end
      end
    
        if b.id == "5" and stade == "" and MultiUPG1Lvl >= 1 and mouse.press then
          if Points >= MultiUPG2 and MultiUPG2Lvl < 10 then
            Points -= MultiUPG2
            MultiUPG2Lvl += 1
            MultiBoost = (MultiBoost * 2)
            if MultiUPG2 < 1e6 then
              MultiUPG2 *= 10
            end
            if MultiUPG2 >= 1e6 then
              MultiUPG2 *= 25
            end
          end
        end

            if b.id == "6" and stade == "" and MultiUPG2Lvl and mouse.press then
              stade = "prestige_mode"
        end
          
          if b.id == "7" and stade == "" and mouse.press then
        storage.set("point", 0)
        storage.set("Base_UPG1", 0)
        storage.set("Point_Gain", 0)
        storage.set("Multi_UPG1", 0)
        storage.set("Multi_UPG1Lvl", 0)
        storage.set("formula_v1", 0)
        storage.set("formula_v2", 1)
        storage.set("MultiUPG2_Lvl", 0)
        storage.set("MultiUPG2", 0)
        storage.set("formula_v3", 1)
        storage.set("prestige", 0)
        storage.set("PUPG1", 0)
        storage.set("formula_v4", 1)
        storage.set("Automation1", 0)
        storage.set("PUPG2", 0)
        storage.set("PFormula_v1", 1)
        storage.set("PFormula_v2", 1)
        storage.set("PUPG3_G", 0)
        storage.set("PreFeature", 0)
        storage.set("XPFormula_v1", 1)
        storage.set("XPFormula_v2", 1)
        storage.set("XPFormula_v3", 0)
        storage.set("Levels", 0)
        storage.set("MaxXp", 50)
        storage.set("xpboostdisplay1", 1000)
        storage.set("PUPG3", 0)
        Points = 0
        BaseUPG1 = 10
        BaseBoost = 0
        MultiBoost = 1
        MultiUPG1 = 250
        MultiUPG1Lvl = 0
        MultiUPG2Lvl = 0
        MultiUPG2 = 10000
        ExpondentalBoost = 1
        PrestigePoints = 0 
        PrestigeBought = 0
        PrestigeBoostMulti = 1
        PercentClick = 0
        PrestigeBought2 = 0
        PPMultiBoost = 1
        PPExpondentalBoost = 1
        PrestigeBoughtG = 0
        PrestigeBoughtF = 0
        ExpondentalBoostXP = 1
        BaseBoostXP = 0
        MultiBoostXP = 1
        XP = 0
        MaxXp = 50
        BoostDisplayPoints = 1000
        PrestigeBought3 = 0
        msg = "GAME RESET!"
        msgTimer = 120
      end
        
      if b.id == "8" and stade == "" and PrestigeBoughtF == 1 and mouse.press then
        stade = "Level"
      end
      
      if b.id == "9" and stade == "" and mouse.press and UPGcooldown < 1 then
        stade = "Guide"
      end
    end
//Prestige Menu Buttons--------------------------------------------------     
 
  if stade == "prestige_mode" then
    color = "rgb(0,26,255)"
    visual = "prestige"
    colorSub1 = "rgb(0,13,127)" 
    color2 = "rgb(0,26,255)"
    button1 = "prestige_reset"
    if mouse.pressed and mouse.y < -30 and mouse.y > -70 and abs(mouse.x) < 75 then
      prestige()
    end
    if mouse.pressed and mouse.y < 15 and mouse.y > -15 and mouse.x < 165 and mouse.x > 135 then
      Xbutton()
    end
    if mouse.pressed and mouse.y < -35 and mouse.y > -65 and mouse.x < -122.5 and mouse.x > -187.5 then
      UPGTree1()
    end
  
   

  elsif stade == "" then
    color = "rgb(85,198,255)"
    visual = ""
    
 //Guide Tab-----------------------------------------------------------------------------------------------   
  elsif stade == "Guide" then
    color = "rgb(255, 255, 200)"
    if mouse.pressed and mouse.y < 55 and mouse.y > 45 and mouse.x < 130 and mouse.x > 120 then
      Xbutton()
    end
    if mouse.pressed and mouse.y < 85 and mouse.y > 65 and mouse.x < -90 and mouse.x > -150 then
      GuideTabPoints()
    end
    if mouse.pressed and mouse.y < 60 and mouse.y > 40 and mouse.x < -90 and mouse.x > -150 then
      GuideTabPrestige()
    end
    
  elsif stade == "Guide_Points" then
    color = "rgb(200, 255, 220)"
    visual = "point_coin"
    if mouse.pressed and mouse.y < 10 and mouse.y > -10 and mouse.x < -115 and mouse.x > -135 then
      ReturnToGuide()
    end
  
  elsif stade == "Guide_Prestige" then
    color = "rgb(200, 255, 220)"
    visual = "prestige_coin"
    if mouse.pressed and mouse.y < 10 and mouse.y > -10 and mouse.x < -115 and mouse.x > -135 then
      ReturnToGuide()
    end
    
  
    
    

    
    
    
    
    
//Prestige Upgrade tree buttons-----------------------------------------
  elsif stade == "UPG_tree_prestige" then
    color = "rgb(0,120,150)"
    color2 = "rgb(0,0,0)"
    visual = "prestige_upgtree"
    if mouse.pressed and PrestigeBought < 1 and mouse.y < -40 and mouse.y > -80 and abs(mouse.x) < 22.5 then
      PreTree1()
    end
    if mouse.pressed and mouse.y < 55 and mouse.y > 45 and mouse.x < 130 and mouse.x > 120 then
      Xbutton()
    end
    if mouse.pressed and PrestigeBought >= 1 and PrestigeBought2 < 1 and mouse.y < 10 and mouse.y > -30 and mouse.x < 72.5 and mouse.x > 37.5 then
      PreTree2()
    end
    if mouse.pressed and PrestigeBought >= 1 and mouse.y < 10 and mouse.y > -30 and mouse.x < -37.5 and mouse.x > -72.5 then
      PreTreeG1()
    end
    if mouse.pressed and PrestigeBought2 >= 1 and PrestigeBoughtG >= 1 and PrestigeBoughtF < 1 and mouse.y < 60 and mouse.y > 20 and abs(mouse.x < 22.5) then
      PreTreeF1()
    end
    if mouse.press and UPGcooldown < 1 and PrestigeBoughtF == 1 and mouse.y < 15 and mouse.y > -15 and mouse.x < 190 and mouse.x > 170 then
      NextUPGTREETab()
    end
    
  elsif stade == "UPG_tree_prestige2" then
    color = "rgb(0,120,150)"
    color2 = "rgb(0,0,0)"
    visual = "prestige_upgtree"
    if mouse.pressed and mouse.y < 55 and mouse.y > 45 and mouse.x < 130 and mouse.x > 120 then
      Xbutton()
    end
    if mouse.press and UPGcooldown < 1 and PrestigeBoughtF == 1 and mouse.y < 15 and mouse.y > -15 and mouse.x < -170 and mouse.x > -190 then
      BackUPGTREETab()
    end
    if mouse.pressed and PrestigeBought3 < 1 and mouse.y < -40 and mouse.y > -80 and abs(mouse.x) < 22.5 then
      PreTree3()
    end
  
    
//Golden Prestige Upgrade functions----------------------------------
  elsif stade == "GoldUPG1" then
    color = "rgb(200,200,200)"
    if mouse.press and PrestigeBoughtG == 0 and mouse.y < -35 and mouse.y > -65 and mouse.x < 10 and mouse.x > -110 then
      PreTreeG1_Lvl1()
    elsif mouse.press and PrestigeBoughtG == 1 and mouse.y < -35 and mouse.y > -65 and mouse.x < 10 and mouse.x > -110 then
      PreTreeG1_Lvl2()
    elsif mouse.press and PrestigeBoughtG == 2 and mouse.y < -35 and mouse.y > -65 and mouse.x < 10 and mouse.x > -110 then
      PreTreeG1_Lvl3()
    elsif mouse.pressed and mouse.y < -40 and mouse.y > -60 and mouse.x < 80 and mouse.x > 20 then
      XbuttonTree()
    end
  
  
//Level  button functions-------------------------------------------------------------  
    elsif stade == "Level" then
      color = "green"
      visual = "level_menu"
      if mouse.press and PrestigeBoughtF == 1 and mouse.y < 10 and mouse.y > -10 and abs(mouse.x) < 50 then
        XP += XPGain/8
      end
      if XP >= MaxXp then
        LevelUp()
      end
      if mouse.pressed and mouse.y < 15 and mouse.y > -15 and mouse.x < 165 and mouse.x > 135 then
        Xbutton()
      end
    end
  end
end
  
  


            

  
    
    
    
    

    
    
  

  
  
  
//button visuals-------------------------------------------------------
      if b.oldW < targetW then b.oldW += 1
      elsif b.oldW > targetW then b.oldW -= 1
      end
    
    
      if b.oldH < targetH then b.oldH += 1
      elsif b.oldH > targetH then b.oldH -= 1
      end
    end
  
  

  
//Point Menu Button Visuals--------------------------------------------------------------------
    draw = function() 
      if stade == "" then
        screen.clear("rgb(85,198,255)")
        screen.drawText("POINTS: " + abbreviate(Points),  -150, 75, 20, "Black")
        screen.drawText(abbreviate(ValeurClic), -10, 50, 15, "")
        screen.drawText("=", -50, 50, 15, "")
        screen.drawText("Gain Per Click", -100, 50, 15, "")
      if PercentClick > 0 then 
        screen.drawText(abbreviate(ValeurClic/100*PercentClick), 10, 30, 15, "")
        screen.drawText("=", -40, 30, 15, "")
        screen.drawText("Gain Per Second", -100, 30, 15, "")
      end
    

      
  if msgTimer > 0 then
    screen.drawText(msg, 0, 75, 15, "rgb(255,255,255)")
  end
  
  for b in buttons
    if b.id == "2" then
      screen.drawSprite("point_upgrades", b.x, b.y, b.oldW, b.oldH)
    elsif b.id == "1" then
      screen.drawSprite("save", b.x, b.y, b.oldW, b.oldH)
    elsif b.id == "3" then
      screen.fillRect(b.x, b.y, b.oldW, b.oldH, "orange")
      screen.drawRect(b.x, b.y, b.oldW, b.oldH, "white")
      screen.drawText("+1 BaseGain: " + abbreviate(BaseUPG1), b.x, b.y, 12, "white")
    elsif b.id == "4" and BaseUPG1 >= 12 and MultiUPG1Lvl < 50 then
      screen.fillRect(b.x, b.y, b.oldW, b.oldH, "orange")
      screen.drawRect(b.x, b.y, b.oldW, b.oldH, "white")
      screen.drawText("1.5x Multiplier: " + abbreviate(MultiUPG1), b.x, b.y, 12, "white")
    elsif b.id == "5" and MultiUPG1 >= 500 and MultiUPG2Lvl < 10 then
      screen.fillRect(b.x, b.y, b.oldW, b.oldH, "orange")
      screen.drawRect(b.x, b.y, b.oldW, b.oldH, "white")
      screen.drawText("2x Multiplier:" + abbreviate(MultiUPG2), b.x, b.y, 12, "white")
    elsif b.id == "6" and MultiUPG2 >= 100000  then
      screen.drawSprite("prestige_menu", b.x, b.y, b.oldW, b.oldH)
    elsif b.id == "7" then
      screen.drawSprite("reset", b.x, b.y, b.oldW, b.oldH)
    elsif b.id == "8" and PrestigeBoughtF == 1 then
      screen.drawSprite("levels", b.x, b.y, b.oldW, b.oldH)
    elsif b.id == "9" then
      screen.drawSprite("guide", b.x, b.y, b.oldW, b.oldH)
    end
  end
end
//Prestige(Major)----------------------------------------------------------------------------------------------
//          |
//          |
//          |
//          V

   
//Prestige Menu Visuals-----------------------------------------------------------------------
    if stade == "prestige_mode" then
          screen.clear(color)
          text = "Prestige for Prestige points to speed up progression"
          subText = "1M Points required to prestige"
        screen.drawSprite(visual,0,0, 425, 200)
        screen.drawText(text,0,50,15,color2)
        screen.drawText(subText,0,20,15,colorSub1)
        screen.fillRoundRect(0, -50, 150, 40, 5, "rgb(40,120,100)")
        if Points < 1e6 then
          screen.drawText("Prestige (1.000M)", 0, -50, 15, "#FFF")
        end
        if Points >= 1e6 then
          screen.drawText(("Prestige for: " + abbreviate(PrestigeGain) + " PP"), 0, -50, 10, "#FFF")
        end
        screen.fillRoundRect(150, 0, 30, 30, 30, "rgb(200,50,50)")
        screen.drawText("X", 151, 0, 25, "#FFF")
        screen.fillRoundRect(-150, -50, 75, 30, 30, "rgb(40,120,100")
        screen.drawText("Upgrade Tree", -150, -50, 10, '#FFF')
        screen.drawText("Formula: (Points/1M)^(1/3)", 0 ,-80, 20, "Grey")
      end
//Prestige Upgrade Tree Visual------------------------------------------------------------------------ 
    if stade == "UPG_tree_prestige" then
      screen.clear(color)
      text = "Prestige UPG Tree (tab1)"
      screen.drawSprite(visual,0,0,425,200)
      screen.drawText(text,-70,85,15,color2)
      screen.fillRoundRect(0, -60, 45, 40, 10,"rgb(40,40,255")
      screen.drawText("3x Points", 0 , -50, 10, "black")
      screen.drawText(("Prestige Points: " + abbreviate(PrestigePoints)), 90, 85, 10, "black")
      screen.fillRoundRect(125, 50, 10, 10, 30, "rgb(200,50,50)")
      screen.drawText("X", 125.5, 50, 9, "#FFF")
      if PrestigeBought == 0 then
        screen.drawText("PP: 1", 0, -65, 10, "black")
      end
      if PrestigeBought == 1 then
        screen.drawText("Bought!", 0, -65, 10, "black")
        screen.fillRoundRect(50,-10, 45, 40, 10, "rgb(40,40,255)")
        screen.fillRoundRect(-50,-10, 45, 40, 10, "rgb(255,255,0)")
        screen.drawRoundRect(-50, -10, 45, 40, 10, "rgb(40,40,255")
        screen.drawRoundRect(-50, -10, 44, 39, 10, "rgb(40,40,255")
        screen.drawRoundRect(-50, -10, 43, 38, 10, "rgb(40,40,255")
        screen.setLineWidth(5)
        screen.drawLine(20, -45, 50, -30, "Black")
        screen.drawLine(-20, -45, -50, -30, "Black")
        screen.drawText("2.25x Points", 50, -5, 8.5, "black")
        screen.drawText("Auto Clicks", -50, -5, 8.5, "black")
        if PrestigeBought2 == 0 then
          screen.drawText("PP: 3", 50, -17.5, 10, "black")
        end
        if PrestigeBought2 == 1 then
          screen.drawText("Bought!", 50, -17.5, 10, "black")
        end
        if PrestigeBoughtG < 3 then
          screen.drawText(("Lvl: " + PrestigeBoughtG + "/3"), -50, -15, 10, "black") 
        end
        if PrestigeBoughtG == 3 then
          screen.drawText("Maxed!", -50,-15,10, "black")
        end
        if PrestigeBoughtG > 0 and PrestigeBought2 > 0 then
          screen.fillRoundRect(0, 40, 45, 40, 10, "rgb(50,255,0)")
          screen.drawText("Unlock", -0, 52.5, 8.5, "black")
          if PrestigeBoughtF < 1 then
            screen.drawText("PP: 50", 0, 30, 10, "black")
          end
          if PrestigeBoughtF == 1 then
            screen.drawText("Bought!", 0, 30, 10, "black")
            screen.fillRect(180, 0, 30,20, "white")
            screen.drawText(">", 182.5, 0, 20, "black")
          end
          screen.drawText("Levels", -0, 42.5, 8.5, "black")
          screen.setLineWidth(2)
          screen.drawRoundRect(0,40,45,40,10,"Blue")  
          screen.setLineWidth(5)
          screen.drawLine(50, 10, 20, 40, "black")
          screen.drawLine(-50, 10, -20, 40, "black")
        end
      end
    end
    
    if stade == "UPG_tree_prestige2" then
      screen.clear(color)
      text = "Prestige UPG Tree (tab2)"
      screen.drawSprite(visual,0,0,425,200)
      screen.drawText(text,-70,85,15,color2)
      screen.fillRoundRect(125, 50, 10, 10, 30, "rgb(200,50,50)")
      screen.drawText("X", 125.5, 50, 9, "#FFF")
      screen.fillRect(-180, 0, 30,20, "white")
      screen.drawText("<", -180, 0, 20, "black")
      screen.fillRoundRect(0, -60, 45, 40, 10,"rgb(40,40,255")
      screen.fillRoundRect(75, -60, 45, 40, 10,"rgb(40,40,255")
      screen.fillRoundRect(-75, -60, 45, 40, 10,"rgb(40,40,255")
      screen.drawText("Prestige Points", 0, -50, 7, "black")
      screen.drawText("Boosts Points", 0, -57.5, 7, "black")
      if PrestigeBought3 == 0 then
        screen.drawText("PP: 250", 0, -70, 10, "black")
      elsif PrestigeBought3 == 1 then
        screen.drawText(("X " + (floor(PrestigePointToPointFormatic1*1000)/1000)), 0, -70, 10, "black")
      end
    end
    
    
    

//Golden Upgrade Prestige Visuals---------------------------------------------------------------------------------------      
      if stade == "GoldUPG1" then
        screen.clear(color)
        screen.drawText("Lvl 1: 1+ CPS, 3x Points, 1.5x PP", 0,40,10,"black")
        screen.drawRect(0,0,420,195,"black")
        screen.drawRect(0,30,300, 50,"black")
        screen.drawText("Lvl 2: 1+ CPS, 2x Points, 1.25x PP", 0,30,10,"black")
        screen.drawText("Lvl 3: 1+ CPS", 0,20,10,"black")
        screen.fillRoundRect(-50,-50,120,30,5 "Green")
        screen.drawText("Auto Clicks", 0 ,75, 30, "Black")
        screen.fillRoundRect(50,-50,60,20,5,"rgb(200,0,0")
        screen.drawText("Back", 50, -50, 15, "black")
        if PrestigeBoughtG == 0 then
          screen.drawText("5: Prestige Points", -50, -50, 12.5, "black")
        end
        if PrestigeBoughtG == 1 then
          screen.drawText("15: Prestige Points", -50, -50, 12.5, "black")
        end
        if PrestigeBoughtG == 2 then
          screen.drawText("50: Prestige Points", -50, -50, 12.5, "black")
        end
        if PrestigeBoughtG == 3 then
          screen.drawText("Maxed", -50, -50, 12.5, "black")
        end
      end

//Level Menu visuals----------------------------------------------------------------------------      
      if stade == "Level" then
        screen.clear(color)
        screen.drawSprite(visual, 0, 0, 425, 200)
        screen.drawText(("XP: " + abbreviate(XP) + "/" + abbreviate(MaxXp)), 0, 50, 20, "black")
        screen.fillRoundRect(0, 0, 100, 20, 4, "rgb(200,200,200)")
        screen.drawText("XP", 0, 1, 20, "Black")
        screen.fillRoundRect(150, 0, 30, 30, 30, "rgb(200,50,50)")
        screen.drawText("X", 151, 0, 25, "#FFF")
        screen.drawText("points Multiplyed by 1.5 each level", 100, 30, 10, "black")
        screen.drawText("XP boosted by points by " + floor(PointBoostXP*1000) / 1000, 0, -30, 10, "rgb(0,100,0)")
        screen.drawText("Formula: log(Points)^(1/3)", 0 ,-60, 20, "grey")
        if BoostDisplayPoints > 1000 and BoostDisplayPoints < 10000 then
          screen.drawText(("Points are multiplyed by " + (BoostDisplayPoints/1000)), -100 ,30 ,10, "rgb(0,200,200)")
        end
        if BoostDisplayPoints > 10000 then
          screen.drawText(("Points are multiplyed by " + abbreviate(BoostDisplayPoints/1000)), -100, 30, 10, "rgb(0,200,200)")
        end
      end
//Guide Visuals--------------------------------------------------------------------------     
      if stade == "Guide" then
        screen.clear(color)
        screen.drawRect(0,0,325,190 "black")
        screen.fillRoundRect(-120, 75, 60, 20, 5, "rgb(200,200,200")
        screen.drawText("Points", -120, 75, 15, "black")
        screen.fillRoundRect(125, 50, 10, 10, 30, "rgb(200,50,50)")
        screen.drawText("X", 125.5, 50, 9, "#FFF")
        if MultiUPG2Lvl > 0 then
          screen.fillRoundRect(-120, 50, 60, 20, 5, "rgb(200,200,200")
          screen.fillRoundRect(-120, 25, 60, 20, 5, "rgb(200,200,200")
          screen.drawText("Prestige", -120, 50, 15, "black")
          screen.drawText("UPG Tree", -120, 25, 13, "black")
        end
        if PrestigeBoughtF > 0 then
          screen.fillRoundRect(-120, 0, 60, 20, 5, "rgb(200,200,200")
          screen.drawText("Levels", -120, 0, 15, "black")
        end
      end
      
      if stade == "Guide_Points" then
        screen.clear(color)
        screen.drawSprite(visual, -125 ,57.5, 50, 50)
        screen.drawRect(0,0,325,190 "black")
        screen.drawRect(-125,57.5,65,65 "black")
        screen.drawRect(50,0,200,170 "black")
        screen.drawText("The Point Menu is stage 1 of the game consisting of a few-", 50, 75, 7.5, "black")
        screen.drawText("-Upgrades, The Clicker, and the first main currency Points.", 50, 65, 7.5, "black")
        screen.drawText("------Points and Upgrades------", 50, 45, 15, "black")
        screen.drawText("To gain Points click the red button and to buy upgrades-", 50, 25, 7.5, "black")
        screen.drawText("get enough points you can click the upgrades once you do", 50, 15, 7.5, "black")
        screen.drawText("Its that simple", 50, 0, 10, "black")
        screen.drawText("1M Points for next guide", 50, -15, 15, "black")
        screen.drawText("--------------------------------", 50, -7.5, 15, "black")
        screen.fillRoundRect(-125, 0, 20, 20, 30, "rgb(200,50,50)")
        screen.drawText("X", -124, 0, 18, "#FFF")
      end
      
      if stade == "Guide_Prestige" then
        screen.clear(color)
        screen.drawSprite(visual, -125 ,57.5, 50, 50)
        screen.drawRect(0,0,325,190 "black")
        screen.drawRect(-125,57.5,65,65 "black")
        screen.drawRect(50,0,200,170 "black")
        screen.drawText("The Point Menu is stage 1 of the game consisting of a few-", 50, 75, 7.5, "black")
        screen.drawText("-Upgrades, The Clicker, and the first main currency Points.", 50, 65, 7.5, "black")
        screen.drawText("------Points and Upgrades------", 50, 45, 15, "black")
        screen.drawText("To gain Points click the red button and to buy upgrades-", 50, 25, 7.5, "black")
        screen.drawText("get enough points you can click the upgrades once you do", 50, 15, 7.5, "black")
        screen.drawText("Its that simple", 50, 0, 10, "black")
        screen.drawText("1M Points for next guide", 50, -15, 15, "black")
        screen.drawText("--------------------------------", 50, -7.5, 15, "black")
        screen.fillRoundRect(-125, 0, 20, 20, 30, "rgb(200,50,50)")
        screen.drawText("X", -124, 0, 18, "#FFF")
      end
    end

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community