Ok now I realy hawe to be anoying already.
I set the sound file to play when you pres a certain button and when you pres the other one the sounds are suposed to stop and play another sound.
I set the sounds that the hotspots are supose to play and before it starts to play it should stop all the music. I set the action before "play sound". "Stop music" I mean.
But the music doesn't stop. It just play on with the new sound. So both sounds play at once.
Are you starting the music as a sound effect, since you say "I set the action before "play sound". "? Try using PlayMusic, or the Game - Play music option in the interaction editor, and see if 'Stop music' works then.
Quote from: Ashen on Mon 17/05/2004 16:39:42
Are you starting the music as a sound effect, since you say "I set the action before "play sound". "? Try using PlayMusic, or the Game - Play music option in the interaction editor, and see if 'Stop music' works then.
Ok but what do I have to name the MP3 file so that the music will play.
And I have a inventory question. This is just BTW so...
I ned the scripts for the up and down butons in my inventory.
Are the scripts the same in every inventory or not. And i'm using the monkey island 1 stile inventory. But when I inported the gui the arows were not imported. I don't know why.
I'm not sure wether you're using text scripting or the intercation editor, but I believe that in both, StopMusic stops the background music, and since this is a sound, it may not apply. What I think you need to do is use PlaySound(-1); to stop the sound.
[However, though in this case it should be fine, in other cases, this would stop all playing sound effects (channels 3-5), not just one. Is there a way to use PlaySoundEx(-1,4) or something to stop a specific sound? I can't test it atm..]
Oh, wait, I just found this: StopChannel (int channel). Which breings me to this: Is there a function, or a way to create a custom one, which can return which sound a certain channel is playing (somethng like GetCurrentMusic but for sounds). It seems that IsChannelPlaying and IsSoundPlaying aren't quite right for this purpose. And/or a function about a sound- where (channel) is it playing, if anywhere?
:)
edit: If you'll be using Play Music, you need to use musicx.mp3 or any other format as the filename, where x is the number.
music1.mp3, or whatever number you want. Also, PlayMP3File () in script will let you use a name for the file, e.g
PlayMP3File ("chesney.mp3");
will play "chesney.mp3" as the background music, and can be stopped with StopMusic.
And the script for the inventory buttons is in the global script of a default game, around lines 97 -104.
Quote from: Ashen on Mon 17/05/2004 16:54:43
music1.mp3, or whatever number you want. Also, PlayMP3File () in script will let you use a name for the file, e.g
PlayMP3File ("chesney.mp3");
will play "chesney.mp3" as the background music, and can be stopped with StopMusic.
And the script for the inventory buttons is in the global script of a default game, around lines 97 -104.
I tryed copying the script but it doesnt work. Why?!
If you mean the inventory button script didn't work, did you remember to change the 'if (button == 4)' and 'if (button == 5)' to whatever button numbers you need? And, where did you copy it to?
If by "it doesn't work" you mean the music doesn't play, make sure the music file is in the COMPILED folder of your game (only if you use the PlayMP3File function, otherwise the music files have to be in the main game folder).
Quote from: strazer on Mon 17/05/2004 17:30:47
If by "it doesn't work" you mean the music doesn't play, make sure the music file is in the COMPILED folder of your game (only if you use the PlayMP3File function, otherwise the music files have to be in the main game folder).
no no i ment the scripts. But thanks anyway. And in both I didn't forget.
Where did you paste the script? Could you post the code around it?
OK this is how my script looks like. And if anything is wrong please don't be to critical becous i don't know squat about scripts.
Ã, if (interface == 2) {
Ã, Ã, if (button == 0) {Ã, // open
Ã, Ã, Ã, SetCursorMode(8);
Ã, Ã, Ã, SetGlobalInt(80,1);
Ã, Ã, Ã, }
Ã, Ã, if (button == 1) {Ã, // close
Ã, Ã, Ã, SetCursorMode(8);
Ã, Ã, Ã, SetGlobalInt(80,2);
Ã, Ã, Ã, }
Ã, Ã, if (button == 2) {Ã, // push
Ã, Ã, Ã, SetCursorMode(8);
Ã, Ã, Ã, SetGlobalInt(80,3);
Ã, Ã, Ã, }
Ã, Ã, if (button == 3) {Ã, // pull
Ã, Ã, Ã, SetCursorMode(8);
Ã, Ã, Ã, SetGlobalInt(80,4);
Ã, Ã, Ã, }
Ã, Ã, if (button == 7) {Ã, // give
Ã, Ã, Ã, SetCursorMode(8);
Ã, Ã, Ã, SetGlobalInt(80,5);
Ã, Ã, Ã, }
Ã, Ã, if (button == 4) { // Walk
Ã, Ã, Ã, SetCursorMode(MODE_WALK);
Ã, Ã, Ã, }
Ã, Ã, if (button == 10) {Ã, // turn on
Ã, Ã, Ã, SetCursorMode(8);
Ã, Ã, Ã, SetGlobalInt(80,6);
Ã, Ã, Ã, }
Ã, Ã, if (button == 11) {Ã, // turn off
Ã, Ã, Ã, SetCursorMode(8);
Ã, Ã, Ã, SetGlobalInt(80,7);
Ã, Ã, Ã, }
Ã, Ã, if ((button == 10) & (game.top_inv_item < game.num_inv_items -7))
Ã, Ã, Ã, game.top_inv_item = game.top_inv_item + 4;
Ã, Ã, if ((button == 9) & (game.top_inv_item > 0))
Ã, Ã, Ã, game.top_inv_item = game.top_inv_item - 4;
Ã, Ã, Ã,Â
Ã, Ã, Ã, Ã, }
Ã, Ã, Ã,Â
Ã, Ã, Ã, if ((button == 14) && (game.top_inv_item < game.num_inv_items - game.num_inv_displayed)) {
Ã, Ã, Ã, // scroll down
Ã, Ã, Ã, game.top_inv_item = game.top_inv_item + game.items_per_line;
Ã, Ã, }
Ã, Ã, if ((button == 15) && (game.top_inv_item > 0)){
Ã, Ã, Ã, // scroll up
Ã, Ã, Ã, game.top_inv_item = game.top_inv_item - game.items_per_line;
Ã, Ã, }
Now if some expert would look thrugh it I'd realy apriciate it.
At first glance, you need to get rid of:
if ((button == 10) & (game.top_inv_item < game.num_inv_items -7))
game.top_inv_item = game.top_inv_item + 4;
if ((button == 9) & (game.top_inv_item > 0))
game.top_inv_item = game.top_inv_item - 4;
since it causes a conflict on button 10.
it still doesn't work.
DAMN IT.
Open GUI editor and tell us your inventory GUI name (or number) as well as the numbers of scroll buttons.
I suppose GUI number is 2 but still make sure it is that one.
Quote from: Scorpiorus on Mon 17/05/2004 20:18:06
Open GUI editor and tell us your inventory GUI name (or number) as well as the numbers of scroll buttons.
I suppose GUI number is 2 but still make sure it is that one.
OK
here's the info:
1.) GUI number 2 object number 13
2.) OK I don't exactly understand what you mean with scroll butons but. I hawe 2 arows (up, down)
and 12 other butons(pick up, look at, talk to...)
It's a monkey island stile so the inventory and the actions are in one GUI.
Quote from: viktor on Mon 17/05/2004 20:35:31
2.) OK I don't exactly understand what you mean with scrollÃ, butons but. I hawe 2 arows (up, down)
hehe, yeah I meant scroll
ing arrows. What are their numbers?
Quote from: Scorpiorus on Mon 17/05/2004 20:38:58
Quote from: viktor on Mon 17/05/2004 20:35:31
2.) OK I don't exactly understand what you mean with scroll butons but. I hawe 2 arows (up, down)
hehe, yeah I meant scrolling arrows. What are their numbers?
the up arow is 14 the down arow is 15
ok, your inventory GUI script should look like this:
if (interface == 2) {
if (button == 0) {Ã, // open
SetCursorMode(8 );
SetGlobalInt(80,1);
}
if (button == 1) {Ã, // close
SetCursorMode(8 );
SetGlobalInt(80,2);
}
if (button == 2) {Ã, // push
SetCursorMode(8 );
SetGlobalInt(80,3);
}
if (button == 3) {Ã, // pull
SetCursorMode(8 );
SetGlobalInt(80,4);
}
if (button == 7) {Ã, // give
SetCursorMode(8 );
SetGlobalInt(80,5);
}
if (button == 4) { // Walk
SetCursorMode(MODE_WALK);
}
if (button == 10) {Ã, // turn on
SetCursorMode(8 );
SetGlobalInt(80,6);
}
if (button == 11) {Ã, // turn off
SetCursorMode(8 );
SetGlobalInt(80,7);
}
if ((button == 15) && (game.top_inv_item < game.num_inv_items - game.num_inv_displayed)) {
// scroll down
game.top_inv_item = game.top_inv_item + game.items_per_line;
}
if ((button == 14) && (game.top_inv_item > 0)){
// scroll up
game.top_inv_item = game.top_inv_item - game.items_per_line;
}
}
And one more important thing: select each arrow button and check its Left click property - it must be set to Run Script.
How did it turn out?
I'M GOING CRAZY HERE. Nothing works. I PUSH THAT F****N BUTON BUT NOTHIN HAPINES: WHY!!!!!
No need to panic :)
Could you post the content of the global game_start() function?
Open the global script (Ctrl-G), it's almost on top of the global script.
HALELUJA. I think I got it.
Thanks guys...
I'm glad you solved it, so what was wrong? It can be useful for someone who may face a similar problem.
Also, could you please change the thread topic to something like "problem with inventory gui arrows", so it would be possible to find the thread via the search option (with "inventory", "gui" and "arrows" words to search)? :)
Quote from: Scorpiorus on Tue 18/05/2004 10:16:27
I'm glad you solved it, so what was wrong? It can be useful for someone who may face a similar problem.
Also, could you please change the thread topic to something like "problem with inventory gui arrows", so it would be possible to find the thread via the search option (with "inventory", "gui" and "arrows" words to search)? :)
I feal quite stupid now. I forgot to set the run script option. :P
Yeah, I know it's very easy to forget. Fortunately, the next version of AGS will be setting the left click property to RunScript by default (instead of no action). :)