Alright, it seems to me that there are some missing pieces to our so-called Scripting Manual provided by TGC.
I've taken it upon myself to scavange the source code for anything out of the ordinary, and possibly provide some answers to why some commands don't work.
Let's first take a look at how many Commands there are in the manual as opposed to the actual source, shall we?
In Manual:
58
Conditions
143
Actions
In Source:
59
Conditions
146
Actions
Hmmmm, looks like there's some things that we were not informed of.
1 Condition is missing from the manual, and I just recently ran across it. It is:
Quote: "ANYKEYWITHINZONE=X
is TRUE when an entity specified in the zone's "Use Key" property is within the zone"
Wow, that sounds very useful, especially for puzzles!
I think the reason that this command was left out is because (for some odd reason) they decided not to include the "Use Key" property for zones.
As most of you know, this can worked around by editting the fpe file of a zone, or, as I would recommend, make a new zone and edit IT'S fpe file.
This isn't very dynamic, and I would have LOVED to have a trigger zone with a "Use Key" field just for this specific use. Maybe, with enough begging, Lee will throw in the property for V2 of FPSC Classic. =D
Okay, what Actions are we missing in the manual?
.
.
Found them, and I've given some brief descriptions on what they do.
Quote: "NOROTATE=X
If X is NOT zero then this will prevent the entity from rotating and lock it in position"
Quote: "SETTARGETNAME=X (X as a name, not a number)
Sets the entity's target to the entity whose name is specified by X
(This command was added during update V1.0.4 RC4 - 11/12/06, but the manual had never been updated)"
Quote: "STOPSOUND
Will stop any looping sound currently being played by the entity. (Does not work for MUSIC)"
Okay, that does it for the commands not shown in the manual.
What else is hiding from us?
Well, for starters, let's look at what the manual says about "ACTIVATEIFUSEDNEAR":
Quote: "ACTIVATEIFUSEDNEAR=X
activate entity described in IFUSED and near it"
No... wrong... who wrote this thing?
The fact is, there is actually a hidden property in each entity called "ifusednear", and it functions exactly like the "If Used" property, except... none of the entities allow you to change this property in the editor.
You can change this property by adding it an fpe file by simply adding:
ifusednear = <name of an entity>
Exactly like we've been doing to alter the if used field for entities that don't have one.
Make no mistake, this command has NOTHING to do with how close or far away the entity is. It might as well have been named "ifused2"
Now, WHY TGC decided to include this in the manual but not provide any support for the property is beyond me. I figured that was the reason they excluded "ANYKEYWITHINZONE" from the manual, but... w/e.
Let's now talk about another command that I've had the ... pleasure... of dealing with:
Quote: "MUSICVOLUME=X
sets the music volume in the range of 0-100"
Now, this sounds very useful, especially for fading in music! Only problem is, it doesn't function exactly like it says it does.
I dunno what the person was thinking when they coded this command, but it doesn't sound like they trusted scripters to know what they were doing, so guess what?
This command ACTUALLY sets the volume anywhere from 80-100... and the value you provide determines where the volume will be in that range.
Let's look at the formula used for this:
80 + (X / 5)
Where X is the value you've given to the command. So if you wanted to mute the music and gave it a value of 0, you've ACTUALLY set the volume to 80.
So, long story short, do a little algebra and you'll find that if you WANT the volume to be muted, you actually have to give this command a value of -400.
This was a big mistake in FPSC, as it prevents users from accurately controlling music volume.
Welp, now that you know what mute level REALLY is, you should now have the control you need.
Next on my list of things to talk about (and this one may just help out those who were trying to deal with 3D sounds) is:
Quote: "SOUNDSCALE=X
changes the 3D sound scale by percentage X"
Well, there isn't actually anything wrong with the description, its just that some people may not have noticed this in the manual or may have been confused by it's meaning.
This command will make 3d sounds in FPSC louder or quieter depending on the value you've given it.
The default value of this is "100", or normal volume. If you give this command a value of "200", then all 3d sounds will be twice as loud as they were before. As such, a value of "50" will make all 3d sounds half as loud as they were before.
Sounds like a great command right?
While we're on the topic of sounds, let me make one thing of note on the 3d sounds and the 2d sounds in FPSC.
In the manual, this is what's written:
Quote: "SOUND=X
plays a sound specified by the X filename. Use $0 to specify sound set
3DSOUND=X
plays a 3D sound specified by the X filename. Use $0 for sound set"
This .. is .. FALSE!!!
This is what the manual SHOULD SAY:
Quote: "PLRSOUND=X
plays a sound specified by the X filename. Use $0 to specify sound set
SOUND=X
plays a 3D sound specified by the X filename. Use $0 for sound set"
This is how they actually work. If you were to try and use "3dsound" in a script, you will not hear anything. This is because it IS NOT A COMMAND! The command to play a 3D sound is "sound", and the command to play a sound heard from anywhere (2d sound) is "plrsound".
Keep that in mind.
Next up on my list is a command that just stuck out at me like a sore thumb when surfing through the source.
Quote: "ENTITYWITHINZONE
is true when an entity is within the trigger zone"
Well, guess what boys and girls? This command never got programmed. That's right! In the source there is a big "TODO" in the section of code for this command.
From what the manual says, I'd think that this command would function exactly like the "ANYWITHINZONE" command. If this is what you were desiring, then you may want to use that command instead.
Just know that this command never made it out the starting gates.
This concludes my brief tutorial on "Scripting Mis-Mentions".
Have fun, everyone!
The one and only,
~PlystirE~