Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
DooMBoy

Scripting

Recommended Posts

OK, I've wrote and compiled a script for the version of E1M1 I've been working on, it looks like this:

#include "zcommon.acs"

script 1 void

{
Print s("Heh!");
delay (const:35);
}
I've created a switch, tagged the line ACSAlwaysExecute, and set the script to 1. Yet when I try to hit the switch, the game tells me "P_StartScript Script 1 not found."

Help!

Share this post


Link to post

DooMBoy, also be aware that the "delay" entry in your script does nothing except keep the script running for a second so you can't get more than one "heh" a second, unless you use AcsAlwaysExecute instead of AcsExecute.

Share this post


Link to post

Try this:

#include "zcommon.acs"

script 1 (void)
{
print(s:"Heh!");
delay(const:35);
}

Share this post


Link to post

Damn, I forgot to mention the zcommon.acs thing this time. (I suggested it last time someone had this problem)

/me realises stupid mistake, but can't delete the post, so prints this message instead and says Doh!

Share this post


Link to post
Ichor said:

Try this:

#include "zcommon.acs"

script 1 (void)
{
print(s:"Heh!");
delay(const:35);
}

I did exactly that, saved the file to the level, saved the Behavior, and still won't work. What next?

Share this post


Link to post

The editor I am using is DeePSea. Though I have a sneaking suspicion that ZDoom 1.22 (the version of ZDoom that I'm using) is the wrong version to use.

Share this post


Link to post

Well, I got my first script to execute! :)
Now, how do I put more than one script in a level and get it to execute?

Share this post


Link to post

Simply name your scripts script 1/script 2/script 3 etc. Change script number in the trigger line's args accordingly.

Share this post


Link to post

I've tried that, and it doesn't work. It'll execute the first script, but no go with the second one. :(

Share this post


Link to post

Use a different line to trigger the second script, not the same line as for the first. Make sure you pay attention to how it's triggered, as in walk-over, use, shoot, and whether you flag the line as repeatable or not, etc.

Later, when you want to use the same line for multiple scripts, change its texture, block or unblock it, you can look into setlineidentification and setlinespecial. Setlineidentification assigns a number to a line. Setlinespecial assigns the function or script number to the line.

Share this post


Link to post

Try having a look through Rick Clark's scripting tutorials ( http://zdoom.notgod.com/zdkb/scriptprimer.html ) in the Zdoom knowledge base ( http://zdoom.notgod.com/zdkb/ ). Some of the tutorials are quite involved, but a great many are very clearly and simply put. They tend to deal with WAD Author, but most of the priciples are easily transferable to other editors, especially where something like scripting is concerned.

Share this post


Link to post
DooMBoy said:

I've tried that, and it doesn't work. It'll execute the first script, but no go with the second one.

How are you trying to set up your scripts? (Post your script here for detailed comments.)

Your OPEN script should contain all the specials that you want activated at startup. Your regular scripts will all be triggered after the game starts. (Some scripts may even be triggered by other scripts.) As Biffy said, make sure you have your linedef triggers set properly. Here is an example set of scripts:

#include "zcommon.acs"

script 1 OPEN

{ TranslucentLine(1,64); //Glass throughout map
Setlineblocking(1,BLOCK_EVERYTHING);//Glass throughout map
TranslucentLine(2,128); //Laser
SetLineSpecial(2,80,3,0,0,0,0); //Laser, script 3
TranslucentLine(3,128); //Force field SetLineSpecial(3,80,5,0,0,0,0); //Force Field script 5
Sector_SetColor(4,96,96,96); //Underwater color
Sector_SetColor(5,32,224,0); //Hydraulics (green)
Sector_SetColor(6,224,128,32); //Computers (orange)
Sector_SetColor(31,255,255,0); //Computers (yellow)
Ceiling_CrushAndRaise(25,96,128); //Pistons Sector_SetDamage(44,400,0); //Elevator shaft
ChangeCamera (const:7, 1, 0); //Opening cut scene
ACS_Execute (const:25, 0, 0, 0, 0); //Opening cut scene
}

//////////////////////////////////////////////////////////////////////
// Script 3: Activates laser barrier when player tries to cross //
// Disintegrates player //
//////////////////////////////////////////////////////////////////////

int laserflag;
script 3 (void)
{
if (laserflag==0)
damagething(400);
}

//////////////////////////////////////////////////////////////////////
// Script 4: Deactivates laser barrier //
// Removes texture, eliminates damage //
//////////////////////////////////////////////////////////////////////

script 4 (void)
{
if (laserflag==0)
setlinetexture (2, SIDE_FRONT, TEXTURE_MIDDLE, "-");
setlinetexture (2, SIDE_BACK, TEXTURE_MIDDLE, "-");
setlineblocking(2, OFF);
laserflag=1;
print (s:"Laser has been deactivated.");
}

//////////////////////////////////////////////////////////////////////
// Script 5: Repulsion & damage from Force Field (red key) //
//////////////////////////////////////////////////////////////////////

script 5 (void)
{
thrustthing(random(192, 255), 8);
damagething(5);
}

//////////////////////////////////////////////////////////////////////
// Script 6: Deactivates Force Field (Red Key Card required) //
// Removes texture, eliminates damage //
//////////////////////////////////////////////////////////////////////

int force1;
script 6 (void)
{
if (force1==0)
setlinetexture (3, SIDE_FRONT, TEXTURE_MIDDLE, "-");
setlinetexture (3, SIDE_BACK, TEXTURE_MIDDLE, "-");
setlineblocking(3, OFF);
force1=1;
print (s:"Force Field has been deactivated.");
}

Share this post


Link to post
Enjay said:

Try having a look through Rick Clark's scripting tutorials ...

Welcome back, Nigel. I trust your travels were enjoyable and at least somewhat relaxing.

Share this post


Link to post
ReX said:

Welcome back, Nigel. I trust your travels were enjoyable and at least somewhat relaxing.


Thanks, yeah, lots of travelling around the UK, getting drunk in many towns :-) Not sure if relaxing is quite the word, but great fun none the less. 7 weeks of vacation, only about 1 & 1/2 of which were spent at home.

Oh yeah, and (as always) nice clear, well laid out scripts as examples from the guy I did most of my copying and pasting from when trying to get a grip on how to put a script together.

Share this post


Link to post

#include "zcommon.acs"

script 1 void
{
print {s:"Scripting is teh l337.");
}
:)

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×