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

Scripts, scripts, scripts...

Recommended Posts

Hi,I'm back to editing again. To start off, I found a weird bug in WA.
I made a sector within a sector, everyone knows how to do that :)
Anyway, I tried to delete that sector because it was messed up in Zdoom. BUT, when I deleted the last linedef, WA crashed. I tried to delete it again, still crash. I managed to isolate the problem so my map run ok. Anyone knows why WA crashed ?

Now for the script part. I've tried a "if" script but I always get an error when compiling and Zdoom tutorial don't talk much about it. I just want to print something when a=1 and something else when a=anything else. It looks like this:

int a = 1;
script 1 ( void )
{
if ( a=1 )
{
print (s:"Blah, Blah, Blah.");
else
print (s:"Bleh, Bleh, Bleh.");
}
}

It says the problem is at line 12: if ( a=1)
Can someone tell me what's wrong ?

Share this post


Link to post

simply change it to
if(a == 1)
that will work.
Also, I'm not sure if
int a=1;
works correctly. IIRC older ACC versions had problems with that, but maybe it works now...

Share this post


Link to post

WadAuthor can sometimes get cranky if you "wipe out" a sector by deleting its lines. Go to sector mode (hit the S key), hilight the sector you want do delete, then hit the delete key. Depending on the sector layout, this will usually delete the sector but in a few cases, void space will be left where the sector was (lines become one-sided). You can delete those one-sided lines without problem.

Someone else needs to answer the script question, I have no references here.

Share this post


Link to post

Just noticed another problem

Darkstalker said:

script 1 ( void )
{
if ( a=1 )
{
print (s:"Blah, Blah, Blah.");
else
print (s:"Bleh, Bleh, Bleh.");
}
}


the "else" is misplaced. Change the script to that:

script 1 ( void )
{
if ( a == 1 )
print (s:"Blah, Blah, Blah.");
else
print (s:"Bleh, Bleh, Bleh.");
}

Share this post


Link to post
Biffy said:

WadAuthor can sometimes get cranky if you "wipe out" a sector by deleting its lines. Go to sector mode (hit the S key), hilight the sector you want do delete, then hit the delete key. Depending on the sector layout, this will usually delete the sector but in a few cases, void space will be left where the sector was (lines become one-sided). You can delete those one-sided lines without problem.

Someone else needs to answer the script question, I have no references here.


I tried to delete the whole sector but i can't select it, like when creating a column, after a while,it's impossible to select the sector.

boris said:

Just noticed another problem



the "else" is misplaced. Change the script to that:

script 1 ( void )
{
if ( a == 1 )
print (s:"Blah, Blah, Blah.");
else
print (s:"Bleh, Bleh, Bleh.");
}


Grrrrr. I hate the "==". I always forget it in my multimedia class. I should've thought about it. It should be add to Zdoom reference because the "==" is not there. Thx all.

Share this post


Link to post

Heh, I got in another problem :(
Is acc 1.21 the newest ? I tried a very, very simple script

script 4 (void)
{
Transfer_CeilingLight (const:3);
}

It doesn't recongnize the transfert lights. I even copied it from zdoom editing reference to be sure I haven't made a spelling mistake and it didn't change.It says a syntax error and missing arguments... But the tag is the only argument, right ?

Share this post


Link to post

Hm, I think that is a line special, not a script function. The sector which is faced by the front side of a line can transfer its light value to another sector. Give that other sector a tag (the sector in which you want to transfer a floor or ceiling light different from its own lighting), then assign the special Transfer_CeilingLight or Transfer_Floorlight to a line facing the "control" sector, referencing the tag number you used. It'll become active when the game starts.

Share this post


Link to post

"I tried to delete the whole sector but i can't select it, like when creating a column, after a while,it's impossible to select the sector."

In that case, you might have made some sector number reassignments to the fronts or backs of some lines. Or, flipped lines, merged lines, something to confuse the editor. You can usually find and fix those things manually.

Share this post


Link to post
Biffy said:

Hm, I think that is a line special, not a script function. The sector which is faced by the front side of a line can transfer its light value to another sector. Give that other sector a tag (the sector in which you want to transfer a floor or ceiling light different from its own lighting), then assign the special Transfer_CeilingLight or Transfer_Floorlight to a line facing the "control" sector, referencing the tag number you used. It'll become active when the game starts.


What I've wanted is that the lightning of the whole room is 80. When I turn a switch "on" the texture (Tlight6_...) lighting goes to 160 and the sector around the light are a bit brighter but since it is a ceiling light texture the ceilings around the light must still be 80. Only the floor around TLight must have a brighter lightning. Does this mean it is impossible to do ?

Biffy said:

In that case, you might have made some sector number reassignments to the fronts or backs of some lines. Or, flipped lines, merged lines, something to confuse the editor. You can usually find and fix those things manually.


When I tried to restart my computer, it didn't want to shut Win98 because WA made an error with MS-DOS so I shutted down my computer. This morning when I turned it back on I tried again to delete it and now it worked...

Share this post


Link to post
boris said:

the "else" is misplaced.

Sort of a matter of style:) To me he's missing {} as in:

if ( a==1 )
{ print (s:"Blah, Blah, Blah.");
}
else
{ print (s:"Bleh, Bleh, Bleh.");
}

The advantage of always using {} is that it's much easier to modify and add future code (with fewer mistakes).

Share this post


Link to post

I think you can get any effect you want with lighting. You can change the sector lighting by script, light_fade or something like that. If you have a transfer floor light or transfer ceiling light into sector A, controlled by sector B, you can change lighting in sector A with the floor or ceiling remaining as it was. I also expect that if you scripted a change of lighting in sector B, the floor or ceiling light in sector A would change accordingly.

Share this post


Link to post
Darkstalker said:

Heh, I got in another problem :(
Is acc 1.21 the newest ? I tried a very, very simple script

script 4 (void)
{
Transfer_CeilingLight (const:3);
}

It doesn't recongnize the transfert lights. I even copied it from zdoom editing reference to be sure I haven't made a spelling mistake and it didn't change.It says a syntax error and missing arguments... But the tag is the only argument, right ?


you need to set (void) to OPEN.

but a really easier way to transfer ceiling lights is to make a dummy sector, set it to the light you want, then set a linedef in that dummy sector to linedef type #211. that should be the transfer light to ceiling.

tagged the sector you want.

Share this post


Link to post
Darkstalker said:

Hi,I'm back to editing again. To start off, I found a weird bug in WA.
I made a sector within a sector, everyone knows how to do that :)
Anyway, I tried to delete that sector because it was messed up in Zdoom. BUT, when I deleted the last linedef, WA crashed. I tried to delete it again, still crash. I managed to isolate the problem so my map run ok. Anyone knows why WA crashed ?

Now for the script part. I've tried a "if" script but I always get an error when compiling and Zdoom tutorial don't talk much about it. I just want to print something when a=1 and something else when a=anything else. It looks like this:

int a = 1;
script 1 ( void )
{
if ( a=1 )
{
print (s:"Blah, Blah, Blah.");
else
print (s:"Bleh, Bleh, Bleh.");
}
}

It says the problem is at line 12: if ( a=1)
Can someone tell me what's wrong ?



you can also try:

int a;
script 1 (void)
{
if(a == 0);
{
print (s:"Blah, Blah, Blah.");
}

{
if(a == 1);
{
print (s:"Bleh, Bleh, Bleh.");
}
}

the else really isn't required for this. but I find it easier IMO.

and to activate the print (s:"Bleh, Bleh, Bleh.");

just have another script do this:

script 2 (void)
{
a=1;
}

thats it! and next time you activate script 1, you'll get the second message.

Share this post


Link to post
Darkstalker said:

Grrrrr. I hate the "==". I always forget it in my multimedia class. I should've thought about it. It should be add to Zdoom reference because the "==" is not there. Thx all.


that "==" feature is REALLY helpful, when making unique scripts. for another example, you could have a door that prints a message instead of opening unless you hit a switch.

here's a example. set the script 1 to a door:

int doorlock;
script 1 (void)
{
if(doorlock == 0)
{
print(s:"leave me alone");
}
{
if(doorlock == 1)
{
Door_Open (const: 1); //tag 1 to the door
}
}

script 2 (void) //when you assign this script as a switch or to a monster thats killed it will activate the second part of script 1 making the door usable.

{
doorlock=1;
}


hope that can help you understand that :)

Share this post


Link to post
Deathman said:

if(a == 0);
{
print (s:"Blah, Blah, Blah.");
}

{
if(a == 1);
{
print (s:"Bleh, Bleh, Bleh.");
}


Ouch, that takes another comparision, that's bad programming, m'kay?

Share this post


Link to post
Big_al said:

Ouch, that takes another comparision, that's bad programming, m'kay?


but it works :p

Share this post


Link to post

Seems like few people understand what I mean.

When the map load, the lightning in roomA is 80.
When I hit a switch, it starts a script.
I want in that script to activate the dummy sector which has 160 in lightning and a Transfert_FloorLight so the floor in roomA take the dummy sector light which is 160 and the ceiling light remain 80.

Void will make the area 160-80 when the map load but I want it to be activated by a script.
If no one know about it, never mind, i'll try to work without it. Gimme a break I'm only at my 1 year in programming :)

Share this post


Link to post

Light_ChangeToValue (const: tag, lightvalue);



tag that to the dummy sector. whatever lights in the dummysector with that linedef type 211, should effect the tagged sector that you want.

or if you want a cool fade in, try this one

Light_Fade (const: tag, lightvalue, fadespeed);





btw, if you want this script to automatically start, type OPEN instead of (void)

Share this post


Link to post

Ok, last one I promise.
About five minutes ago. I was still making my wad that gives me so much trouble :). I just checked for error and every thing was ok except there is no multiplayer and exit . I just checked a minute ago and every of my script have a bad script number. I've got that message on another wad too. But five minute ago I didn't had that message. I just tried with XWE with no better result. Why do I get theses messages ?

Share this post


Link to post

really odd. Try re-implenting the script's behavior.

I don't know whats causing that. I do all my scripts/implenting through DeepSea. I never used XWE....so I really can't find out the problem. but try re-implenting the behavior.

Share this post


Link to post
Deathman said:

really odd. Try re-implenting the script's behavior.

I don't know whats causing that. I do all my scripts/implenting through DeepSea. I never used XWE....so I really can't find out the problem. but try re-implenting the behavior.


Nope, didn't change anything. I use WA to compile, I only use XWE in case WA don't find out the problem.

Share this post


Link to post
Guest
This topic is now closed to further replies.
Sign in to follow this  
×