Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   song only heard by me (https://forums.graalonline.com/forums/showthread.php?t=134261785)

Diablo1 01-20-2011 06:44 PM

song only heard by me
 
here is what i scripted but why am i the only one to hear it?
is there a prob?
I just want it to be heard from all peepz thx

//#CLIENTSIDE
function onCreated(){
timeout=.1;
}
function onTimeout(){
play stef12.mid;
timeout=.1;
}

Fulg0reSama 01-20-2011 06:50 PM

Quote:

Originally Posted by Diablo1 (Post 1624387)
here is what i scripted but why am i the only one to hear it?
is there a prob?
I just want it to be heard from all peepz thx

//#CLIENTSIDE
function onCreated(){
timeout=.1;
}
function onTimeout(){
play stef12.mid;
timeout=.1;
}


Big issue of GS1 and GS2 mixup
Now if you want everyone to hear it a simple way to do this is by a class(not the best but its simple) (I try to give simple answers not most efficient. Someone feel free to correct me)

Put this in a level.
PHP Code:

function onPlayerEnters()
{
join "classname";


Class:
PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
setTimer(0.01);
  
onTimeOut();
}
function 
onTimeOut()
{
  
play ("stef12.mid");
  
setTimer(0.01);


The better way though would to be a tokenized serverflag but I don't have the experience to show proper use of it xP

smirt362 01-20-2011 07:01 PM

You might be crazy

Liberated 01-20-2011 07:16 PM

or you just make it serverside instead of clientside?

Fulg0reSama 01-20-2011 07:17 PM

Quote:

Originally Posted by Liberated (Post 1624391)
or you just make it serverside instead of clientside?

That works too.

ffcmike 01-20-2011 07:26 PM

What's wrong with:

PHP Code:

//#CLIENTSIDE
function onPlayerEnters(){
  
playlooped("stef12.mid");


:confused:

(though I'd personally use a class to handle stuff such as whether the player has chosen an option to disable music or prefers an MP3 to be played instead where applicable)

Liberated 01-20-2011 07:27 PM

I knew you were messing with him, xD

Fulg0reSama 01-20-2011 07:29 PM

Quote:

Originally Posted by ffcmike (Post 1624394)
What's wrong with:

PHP Code:

//#CLIENTSIDE
function onPlayerEnters(){
  
playlooped("stef12.mid");


:confused:

(though I'd personally use a class to handle stuff such as whether the player has chosen an option to disable music or prefers an MP3 to be played instead where applicable)

nodda thing and better than what I said :p

I'd prefer a tokenized serverflag for optimization of music.

cbk1994 01-20-2011 09:58 PM

Quote:

Originally Posted by Fulg0reSama (Post 1624388)
Big issue of GS1 and GS2 mixup
Now if you want everyone to hear it a simple way to do this is by a class(not the best but its simple) (I try to give simple answers not most efficient. Someone feel free to correct me)

Put this in a level.
PHP Code:

function onPlayerEnters()
{
join "classname";



This is incorrect. The proper way to do it is:

PHP Code:

function onCreated() {
  
this.join("classname");


The way you were using join was a weird mixture of GS1 and GS2 that probably wouldn't have worked in either language, and there's no reason to join it in the onPlayerEnters function.

Quote:

PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
setTimer(0.01);
  
onTimeOut();
}
function 
onTimeOut()
{
  
play ("stef12.mid");
  
setTimer(0.01);



There is no excuse for using a timeout here. Also, don't put spaces before functions like you did with play.

Quote:

Originally Posted by Liberated (Post 1624391)
or you just make it serverside instead of clientside?

play and playlooped are clientside functions.

Quote:

Originally Posted by ffcmike (Post 1624394)
What's wrong with:

PHP Code:

//#CLIENTSIDE
function onPlayerEnters(){
  
playlooped("stef12.mid");



This is the proper way to do it.

MrOmega 01-21-2011 02:30 AM

Also, remember not all (if any?) mac and linux users can hear midi files.

Diablo1 01-29-2011 06:05 PM

mhm thx fro correting my scipt but i don't get it when you talk about the 'class'. should i put

function onCreated() {
this.join("classname");
}
in the level or in the 'class' folder in the rc?

callimuc 01-29-2011 06:20 PM

The
PHP Code:

function onCreated() {
this.join("classname");


You put into a level.
The other part is the class which you have to put into the Script Editor.

cbk1994 01-29-2011 06:21 PM

Quote:

Originally Posted by Diablo1 (Post 1626452)
mhm thx fro correting my scipt but i don't get it when you talk about the 'class'. should i put

function onCreated() {
this.join("classname");
}
in the level or in the 'class' folder in the rc?

Just use this:

PHP Code:

//#CLIENTSIDE 
function onPlayerEnters(){ 
  
playlooped("stef12.mid"); 



Diablo1 01-29-2011 10:26 PM

thx cbk1994 you were right and for all the others you don't need to create a class.
PHP Code:
//#CLIENTSIDE
function onPlayerEnters(){
playlooped("stef12.mid");
}

is the easier way to have it. but if it doesnt work just go on folderconfig then allow the server to read .mid and .mp3 files ;)


All times are GMT +2. The time now is 09:03 AM.

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