Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Playing Mids on Gmap (https://forums.graalonline.com/forums/showthread.php?t=64717)

KuJi 03-13-2006 02:29 AM

Playing Mids on Gmap
 
I have a script which plays mids on the overworld. Well, for some reason you only hear the sounds if you go into a room, and then go back outside. And it will only play that sound for that level.

Anyway, hopefully someone knows a fix.

I am using stef midis. (stef3/27/32/51 etc.. )
Using play("stef32.mid"); for example.

If you know a fix, don't be scared, please reply. :O

Yen 03-20-2006 09:46 PM

Use a system NPC to play the music for each level.

PHP Code:

this.midi = {"stef3""stef23""stef7"};
this.midi.stef3 = {"level2.nw""level3.nw""level4.nw"};
this.midi.stef23 = {"level5.nw""level6.nw""level7.nw""level8.nw"};
this.midi.stef7 = {"level9.nw""level10.nw"};
for (
athis.midi) {
  if (
makevar("this.midi." a).index(player.level) >= 0playlooped(".mid");



Skyld 03-20-2006 10:55 PM

Quote:

Originally Posted by Yen
Use a system NPC to play the music for each level.

PHP Code:

this.midi = {"stef3""stef23""stef7"};
this.midi.stef3 = {"level2.nw""level3.nw""level4.nw"};
this.midi.stef23 = {"level5.nw""level6.nw""level7.nw""level8.nw"};
this.midi.stef7 = {"level9.nw""level10.nw"};
for (
athis.midi) {
  if (
makevar("this.midi." a).index(player.level) >= 0playlooped(".mid");



I never understood your obsession with makevar().

Yen 03-20-2006 11:11 PM

Quote:

Originally Posted by Skyld
I never understood your obsession with makevar().

("this.midi." @ a) has only worked for me once.

Skyld 03-21-2006 12:46 AM

Quote:

Originally Posted by Yen
("this.midi." @ a) has only worked for me once.

this.midi.(@ a) or so.

KuJi 03-21-2006 07:55 AM

Hmm, can you explain exactly what 'makevar' does? It sounds like it would make a variable, but why make a variable that already exists?

jake13jake 03-21-2006 08:48 AM

Quote:

Originally Posted by KuJi
Hmm, can you explain exactly what 'makevar' does? It sounds like it would make a variable, but why make a variable that already exists?

PHP Code:

this.blahani "carrystill";
this.pblah "ani";
this.pani "blah";
setani(makevar(this.pani this.pblah),null); 

would inevitably give you carrystill. old gscript equivalent of #s(#s(something))

It takes a string and returns the variable that the string indicates.

KuJi 03-25-2006 05:35 AM

Quote:

Originally Posted by jake13jake
PHP Code:

this.blahani "carrystill";
this.pblah "ani";
this.pani "blah";
setani(makevar(this.pani this.pblah),null); 

would inevitably give you carrystill. old gscript equivalent of #s(#s(something))

It takes a string and returns the variable that the string indicates.

So, it merges the variables together?

jake13jake 03-25-2006 03:48 PM

Quote:

Originally Posted by KuJi
So, it merges the variables together?

It takes a string value (the string value can be stored in variables), and returns the variable of the name of the string value.

Skyld 03-25-2006 04:45 PM

Quote:

Originally Posted by jake13jake
It takes a string value (the string value can be stored in variables), and returns the variable of the name of the string value.

Well, a link to the variable.

Loriel 03-25-2006 05:05 PM

Quote:

Originally Posted by Skyld
I never understood your obsession with makevar().

It is infinitely clearer than the obscure this.(@) thing!

Skyld 03-25-2006 05:16 PM

Quote:

Originally Posted by Loriel
It is infinitely clearer than the obscure this.(@) thing!

I disagree. I find it easier to read over and recognise variable prefixes to identify variables than seeing "makevar".

Loriel 03-25-2006 05:17 PM

Quote:

Originally Posted by Skyld
I disagree. I find it easier to read over and recognise variable prefixes to identify variables than seeing "makevar".

Well, your opinion is wrong.
Clearly.
:mad:

jake13jake 03-25-2006 05:50 PM

Quote:

Originally Posted by Skyld
I disagree. I find it easier to read over and recognise variable prefixes to identify variables than seeing "makevar".

makevar is easier for writing.
this.(@) thing is easier for reading.
makevar, however, is a lot more flexible.

ApothiX 03-25-2006 06:35 PM

Quote:

Originally Posted by jake13jake
makevar is easier for writing.
this.(@) thing is easier for reading.

That is 100% your opinion.

Quote:

Originally Posted by jake13jake
makevar, however, is a lot more flexible.

How do you figure?

Maniaman 03-25-2006 06:53 PM

this.(@) is also technically more efficient I believe, as it is not a function like makevar.

Yen 03-25-2006 09:28 PM

...
When I use this.(@), it's trying to call the function of whatever follows the @.

KuJi 03-25-2006 09:46 PM

Hmm, can someone post a small portion of a script using makevar with some sort of output? I could probally get it then, else, I've heard about 15 diff things lol.

jake13jake 03-26-2006 06:21 AM

Quote:

Originally Posted by KuJi
Hmm, can someone post a small portion of a script using makevar with some sort of output? I could probally get it then, else, I've heard about 15 diff things lol.

Simplest Example:
PHP Code:

function onWeaponFired() {
  
this.orangeboogaloo "hahahhaha";
  
player.chat makevar("this.orangeboogaloo");



Yen 03-26-2006 06:34 AM

Quote:

Originally Posted by jake13jake
PHP Code:

Simplest Example:
function 
onWeaponFired() {
  
this.orangeboogaloo "hahahhaha";
  
player.chat makevar("this.orangeboogaloo");



>_> That's not a good use of makevar.
Let's say an NPC logs how many times a player enters a level.
When the player says '/showtimes,' it tells them how many times they've been in.

PHP Code:

function onPlayerEnters() {
  
makevar("this.timesentered_" player.account)++;
}

function 
onPlayerChats() {
  if (
player.chat == "/showtimes"player.chat makevar("this.timesentered_" player.account);


When a player enters the level, it adds 1 to 'this.timesentered_<their account>'
So when I enter, it increases this.timesentered_Yen by 1.

KuJi 03-26-2006 07:17 AM

Can't I just did it regularly then? It isn't really needed then :O.


All times are GMT +2. The time now is 02:31 PM.

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