Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   musicpos and musiclen (https://forums.graalonline.com/forums/showthread.php?t=58083)

Gman4pwnu 03-15-2005 06:51 AM

musicpos and musiclen
 
i tried play musicname.wav;(real file on server plays right)
and then setplayerprop #c,#v(musiclen(musicname.wav)) but that just showed as 0, so i tried just musiclen but that didn't work either.

so i remain with the question, how do they work?

Kaimetsu 03-15-2005 07:02 AM

Dunno, never used them. But I would frantically recommend that you use mp3s for music.

Gman4pwnu 03-15-2005 07:37 AM

alright kai.

KuJi 03-15-2005 10:40 PM

First off, your going to have to convert the seconds into minutes for it to play right. I believe it only works with mp3's.

Anyway, I was working on converting and I converted how long mp3 is, but I can't convert how much were into the song already.

If someone can shorten it, or make it so it shows how much were into the song, I'll be grateful.


NPC Code:

// NPC made by KuJi
if (created) play http://www.graalx.us/downloads/music/Encore/03-eminem-never_enough_(feat_50_cent_and_nate_dogg)_(produce d_by_dr_dre_and_mike_elizondo).mp3;

if (playerchats && strequals(#c,/time)) {
length = musiclen/60;
length2 = strtofloat(#v(int(length)))*60;
length3 = musiclen-length2;
say2 #v(int(musicpos))/#v(int(musiclen)) - #v(int(length)):#v(int(length3));
}




I left the play part in their, cause that's the song i tested it in.

Kaimetsu 03-15-2005 11:36 PM

Quote:

Originally Posted by KuJi
strtofloat(#v(int(length)))

Sounds like you learned at the ProjectShifter school of scripting. Why do you use #v and strtofloat here?

KuJi 03-16-2005 01:51 AM

Quote:

Originally Posted by Kaimetsu
Sounds like you learned at the ProjectShifter school of scripting.


O.o, PS school of scripting? O.o

Quote:

Why do you use #v and strtofloat here?
You can't int it without
NPC Code:
strtofloat(#v(int(blah)))

I think.

Kaimetsu 03-16-2005 02:14 AM

Quote:

Originally Posted by KuJi
O.o, PS school of scripting? O.o

Yes. It is the school where people learn how to script badly.

Quote:

You can't int it without
NPC Code:
strtofloat(#v(int(blah)))

I think.
What purpose do the strtofloat and #v serve in that example? What made you think that you need them?

KuJi 03-16-2005 02:27 AM

Quote:

Originally Posted by Kaimetsu
What purpose do the strtofloat and #v serve in that example? What made you think that you need them?

I don't know, I thought that was right. It still works so who cares O.o. Take it off then lol

Kaimetsu 03-16-2005 02:30 AM

Quote:

Originally Posted by KuJi
It still works so who cares O.o

Pretty much any competent scripter. The kind that know their tools and combine them to achieve precisely the result they want. The rest of you are just pressing buttons and hoping for the best.

KuJi 03-17-2005 04:20 AM

Quote:

Originally Posted by Kaimetsu
Pretty much any competent scripter. The kind that know their tools and combine them to achieve precisely the result they want. The rest of you are just pressing buttons and hoping for the best.


Who cares, just do the other part of the script (Where it displays how much your in the song through min + seconds) :-D

Kaimetsu 03-17-2005 04:23 AM

Quote:

Originally Posted by KuJi
Who cares

You ask that question far too often.

Dach 03-17-2005 07:12 PM

Quote:

Originally Posted by KuJi
strtofloat(#v(int(length)))*60

should just be 'int(length)*60'


PHP Code:

if (created) {
  
play 33.mp3;
  
mlen int(musiclen);
  
timeout .05;
}
if (
timeout) {
  
cpos int(musicpos);
  
left int(musiclen-musicpos);
  
message Total:#v(int(mlen/60))m#v(mlen%60)s
    
Current:#v(int(cpos/60))m#v(cpos%60)s
    
Left:#v(int(left/60))m#v(left%60)s;
  
timeout .05;


newfeatures2002 says it doesn't work on midis, so unless you have a long wav file, I'd recommend using mp3s.

I still hate the CODE tags very much

Gman4pwnu 03-17-2005 07:35 PM

it wont work with wavs either i tried.


All times are GMT +2. The time now is 02:52 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.