#how would I go about writing a script that calculates the value gained per second? like cash flow

136 messages · Page 1 of 1 (latest)

sturdy sage
#

I get the formula and what I have to do to some degree, but since I'm fairly new to programming I just can't wrap my head around this yet
Essentially what I'm trying to do is have a gui show the player how much income they're receiving per second, like cookie clicker basically, so i need to figure out how to get a value acquired over a period of time

mellow gorge
#

Hey you still need some help?

#

@sturdy sage

#

Can I see what you got started on so far?

sturdy sage
#

hey, yeah

#

i went through a lot of renditions i'm not sure if i can go back

#

though i can share my ideas

mellow gorge
#

So what is the period of time

#

This should be pretty simple I can help you out no problem

tribal verge
#

HELLO

#

HELLO

#

@final portal

final portal
#

what

tribal verge
#

lets help him

#

can we help you inertia

sturdy sage
#

alright thanks man, so i want the cash per second to update dynamically, but over 3 seconds maybe?

tribal verge
#

HELLO INERTIA

sturdy sage
#

yoo

final portal
#

this is in gui right?

sturdy sage
#

yeah

tribal verge
#

YEAH

#

YEAH

final portal
#

and the cash flows every second right?

mellow gorge
#

@sturdy sage so in order to show it on your GUI you need some sort of saving system to keep track of the money the player has earned thus far right?

final portal
#

yeah, it could be a variable or even a numbervalue instance

sturdy sage
tribal verge
#

AREN TO THE RESCUE

#

WOO HOO

#

WOO HOO

#

OOO

#

AREN

#

TAHT SOUNDS A BIT COMPLEX

#

@final portal

#

what do you think

#

what should we do

final portal
sturdy sage
#

🔥

mellow gorge
#

@sturdy sage allright if you got them stored in a table then you can set up a script for click amount money earned as well as upgrades passive income earned. Save it to the same table or datapoint and reflect that number onto your UI

#

that is how I do it everytime in this scenario

tribal verge
#

DAMN

#

BYE

#

YOU ARE FUCKING SMART

#

WTF

#

OK

#

LETS GO

#

@final portal

#

LETS RECRUIT HIM

#

LETS GO

#

AREN

final portal
#

unfortunately, i must stop for now

tribal verge
#

WHTA DO YOU THINK ABOUT WAHT HE SAID

#

ok

#

but I NEED UR OPINION

#

ON WHAT HE SAID

final portal
#

yeah that would also work

tribal verge
#

what was your way

#

is it easier

#

can you tell me

final portal
#

well, idk how the dude structured his system

#

my way would be able to just grab the value just like that

#

alr i gtg cya

last raven
tribal verge
#

HOW WILL YOU STORE THE VALUE

#

IF YOU JUST GRAB IT

last raven
#

like every 5 second, calculate how much you've made

#

and divide that by 5

#

to get ur avg income per second

mellow gorge
#

@sturdy sage Oh sorry, forgot to add after you save the income you can just do math

#

so for example I am coding a game right now to calculate clicks per second

tribal verge
#

LETS GO

#

LETS GO

mellow gorge
#
local clicksPerMinute = (clickCount / elapsedTime) * 60
#

it would be something like that

#

but instead just use your datapoint save

#

and instead of minute calculate for seconds

tribal verge
#

OKOK

#

HES SO SMART

#

WTF

#

SO SMART

sturdy sage
#

aight thank yall a bunch, i'll see if i can attempt to comprehend this and make it work

sturdy sage
mellow gorge
#

Yeah no worries, if you want an idea how I set my variables as well here you go

#
local currentTime = tick()
        local elapsedTime = currentTime - startTime
tribal verge
#

@rustic arch

#

WHY U NO SMART LIKE THIS GUY

#

WHY NOT

#

BUT IM THE SMARTEST

#

IM SMARTETER ALL OF U

rustic arch
#

bro

#

what the fuck is your problem with me

#

you're so fucking childish annoying piece of shit

tribal verge
#

ANGER ISSUES

#

ANGER ISSUES

#

ANGER ISSUES

mellow gorge
#

0.0 wtf is going on

sturdy sage
#

😭

rustic arch
#

idk with that guy

#

he be pressing me for days now for unknown fucking reason

sturdy sage
#

unforch

rustic arch
#

i just helped someone he couldnt help

#

and he got mad

sturdy sage
#

i think he's just messin with ya man

rustic arch
#

nah that dude is jealous

#

lmao

sturdy sage
#

💀 lmao

final portal
#

im back, i think i completely missed the point here so ima say sorry and just leave

sturdy sage
#

ur good, thanks for helping

tribal verge
#

@sturdy sage

#

so

#

did it work

#

did u get help

sturdy sage
#

still figuring a few things out, but i think i'm close

tribal verge
#

who helpd the most

#

@sturdy sage

sturdy sage
#

i'm grateful for everybody equally but i think bye did do the most work

tribal verge
#

@rustic arch

#

I HATE YOU

#

YOU ARE SO MEAN TO ME

#

LOOK HOW NICE

#

INTERTIA IS

sturdy sage
#

you're going to get yelled at 😭

stray harborBOT
#

studio** You are now Level 5! **studio

rustic arch
#

that dude has no friends

#

he wants some attention

tribal verge
#

@rustic arch

#

NOT YOU

#

YOU WERENT THER CHAMPION

final portal
#

i never thought id see rsd beef

hybrid comet
#

uuh is this solved

final portal
#

we gave solutions and ways to do it

#

rn inertia is just trying to implement it