chandelier Posted 23 hours ago Posted 23 hours ago (edited) the goal is to make gg toast like this, by using loop and condition. and toast with value at that specific phase phase 1 Symbol : =----- 10 phase 2 Symbol : ==--- 20 phase 3 Symbol : ===-- 30 phase 4 Symbol : ====- 40 phase 5 Symbol : ===== 50 if more than max phase length then os.exit() local initialPhase = {10, 20, 30, 40, 50} local initialSymbol1 = '=' local initialSymbol2 = '-' while true do --length = initialPhase.Max.Length; if phase = length then phase = initialPhase + 1 symbol1 = symbol1 + initialSymbol1 symbol2max = initialSymbol2 * length symbol2 = symbol2max - initialSymbol2 gg.toast('Symbol :'..symbol..symbol2..' !!', true) gg.toast('\n'..initialPhase, true) else os.exit() end end Edited 23 hours ago by chandelier
0 CmP Posted 14 hours ago Posted 14 hours ago local function createPhaseDisplayer(phaseValues, progressSymbol, backgroundSymbol) local phasesCount = #phaseValues local currentPhase = 0 return function () currentPhase = currentPhase + 1 if currentPhase > phasesCount then os.exit() end local indicatorFirstPart = string.rep(progressSymbol, currentPhase) local indicatorSecondPart = string.rep(backgroundSymbol, phasesCount - currentPhase) local indicator = indicatorFirstPart .. indicatorSecondPart local phaseValue = phaseValues[currentPhase] local displayMessage = string.format("phase %d\nSymbol : %s\n%d", currentPhase, indicator, phaseValue) gg.toast(displayMessage, true) end end local phaseValues = {10, 20, 30, 40, 50} local symbol1 = "=" local symbol2 = "-" local displayPhase = createPhaseDisplayer(phaseValues, symbol1, symbol2) -- Testing all phases with one extra for i = 1, #phaseValues + 1 do displayPhase() end
Question
chandelier
the goal is to make gg toast like this, by using loop and condition. and toast with value at that specific phase
phase 1
Symbol : =-----
10
phase 2
Symbol : ==---
20
phase 3
Symbol : ===--
30
phase 4
Symbol : ====-
40
phase 5
Symbol : =====
50
if more than max phase length then os.exit()
1 answer to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now