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: Doesn't work...?

Previous Thread :: Next Thread 
ContentCrown is not online. ContentCrown
Joined: 06 Apr 2014
Total Posts: 6461
15 Oct 2016 10:35 PM
I want to get a more realistic timer for songs.. But I'm not sure how to do it.

Percentage.Text = Percentage.Text:format("%d:%d", math.floor((Lazerus.TimePosition / 60), Lazerus.TimeLength % 60))

~ Add 5k+ Posts ~{ Previous Name: i_Movie }
Report Abuse
ContentCrown is not online. ContentCrown
Joined: 06 Apr 2014
Total Posts: 6461
15 Oct 2016 10:54 PM
Percentage.Text = string.format("%d0 : %d", (Lazerus.TimePosition/Lazerus.TimeLength), (Lazerus.TimeLength))

~ Add 5k+ Posts ~{ Previous Name: i_Movie }
Report Abuse
ContentCrown is not online. ContentCrown
Joined: 06 Apr 2014
Total Posts: 6461
15 Oct 2016 10:57 PM
Can't figure it out... :/

~ Add 5k+ Posts ~{ Previous Name: i_Movie }
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
15 Oct 2016 10:57 PM
local currentTime = 1200
print(string.format("%.2d:%.2d", math.floor(currentTime / 60),currentTime % 60))

pattern for formatting of 2 integers
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
15 Oct 2016 10:59 PM
here is another example:

for currentTime=0,2000 do
print(string.format("%.2d:%.2d", math.floor(currentTime / 60),currentTime % 60))
wait(0.2)
end

Report Abuse
ContentCrown is not online. ContentCrown
Joined: 06 Apr 2014
Total Posts: 6461
15 Oct 2016 11:01 PM
I'm not using values though.. I'm using an audio..

~ Add 5k+ Posts ~{ Previous Name: i_Movie }
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
15 Oct 2016 11:04 PM
Are you being serious?

Do you not understand what a value is?

Or how lua works at all?

I just used an example variable so it literally does not matter -.-
Report Abuse
ContentCrown is not online. ContentCrown
Joined: 06 Apr 2014
Total Posts: 6461
15 Oct 2016 11:06 PM
*face-palm*

All I have to say to be honest...



~ Add 5k+ Posts ~{ Previous Name: i_Movie }
Report Abuse
ContentCrown is not online. ContentCrown
Joined: 06 Apr 2014
Total Posts: 6461
15 Oct 2016 11:07 PM
Also, I don't know string manipulation or math in Lua, so it's clearly not my fault that I made myself look like an idiot here.

~ Add 5k+ Posts ~{ Previous Name: i_Movie }
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
15 Oct 2016 11:08 PM
Just for future reference:

The TimePosition is a number, so is currentTime, so it should work the same way since they are both numbers. It would work on decimal numbers too because d is for ints
Report Abuse
ContentCrown is not online. ContentCrown
Joined: 06 Apr 2014
Total Posts: 6461
15 Oct 2016 11:13 PM
Also still confused about to do this..

Here's what I'm trying to do:

1. Get the song's time length in minute format

2. While the song is playing, it counts up

Example:

TimeLength = 2:00 -- Minute Format

The number would start at 00:00 and count up to 2 minutes. But you see, I don't know string maniulation at all and I honestly just tried looking it up and I honestly have no idea how to do it so.. I'm out of luck I think unless someone is nice enough to show me how it's done.



~ Add 5k+ Posts ~{ Previous Name: i_Movie }
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
15 Oct 2016 11:14 PM
Simply get rid of the .2 in the first digit or change it to .1
Report Abuse
ContentCrown is not online. ContentCrown
Joined: 06 Apr 2014
Total Posts: 6461
15 Oct 2016 11:14 PM
*About how to do this

Am tired rn.

~ Add 5k+ Posts ~{ Previous Name: i_Movie }
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
15 Oct 2016 11:18 PM
It is pretty easy...

d in format is formatting a number into an integer

combining %_d with another integer creates space in front of it that can fill up
using a decimal number adds 0s for each empty space

f in format is a float number
%_f with an integer does the same as when using %_d with an int
with a decimal it increases the amount of decimal points and rounds them up
Report Abuse
ContentCrown is not online. ContentCrown
Joined: 06 Apr 2014
Total Posts: 6461
15 Oct 2016 11:23 PM
Easy for you, not for me.

Tried doing what you just did in the script and it said it's not a valid format option.

~ Add 5k+ Posts ~{ Previous Name: i_Movie }
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
15 Oct 2016 11:30 PM
for currentTime=0,200 do
print(string.format("%d:%.2d", math.floor(currentTime / 60),currentTime % 60))
wait(0)
end

. ___ .
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
15 Oct 2016 11:35 PM
You can also do more things with audio now such as getting playback volume and using new effects, look up SoundEffects on the wiki and there is also something like :GetPlaybackVolume or something
Report Abuse
ContentCrown is not online. ContentCrown
Joined: 06 Apr 2014
Total Posts: 6461
15 Oct 2016 11:40 PM
Oh really? I couldn't find anything.

~ Add 5k+ Posts ~{ Previous Name: i_Movie }
Report Abuse
Intended_Pun is not online. Intended_Pun
Joined: 10 Aug 2016
Total Posts: 4384
15 Oct 2016 11:42 PM
http://wiki.roblox.com/index.php?title=API:Class/SoundEffect
Report Abuse
ContentCrown is not online. ContentCrown
Joined: 06 Apr 2014
Total Posts: 6461
15 Oct 2016 11:44 PM
Oh, I was looking at the wrong api.

~ Add 5k+ Posts ~{ Previous Name: i_Movie }
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