Scripts... what the hell!!!

Discuss all aspects related to modding Zandronum here.
Post Reply
marcello
New User
Posts: 12
Joined: Mon Jul 13, 2015 5:53 pm

Scripts... what the hell!!!

#1

Post by marcello » Fri Jul 24, 2015 7:03 am

Hello everybody, I'm having some problems with a script in a map I'm making, I'm new in mapping and it's the first time I try to create a script.

I have created an elevator using 3D floor in gzdoom builder, I've put the tag 45 on the floor, on the ceiling of the elevator.
I want that you can call the elevator with a switch and then the elevator came back to the original position after waiting for some second.

This is what I wrote:

script 8 (void)
{
Floor_LowerByValue(45,27,128);
Ceiling_LowerByValue(45,27,128);
Delay(1);
Floor_RaiseByValue(45,27,128);
Ceiling_RaiseByValue(45,27,128);
}

Repetable action;
When player presses use;

The elevator lower correct, but is not raising... What am I missing?
Last edited by marcello on Fri Jul 24, 2015 7:04 am, edited 1 time in total.

ARGENTVM
Retired Staff / Community Team Member
Posts: 446
Joined: Thu Jun 13, 2013 4:08 am

RE: Scripts... what the hell!!!

#2

Post by ARGENTVM » Fri Jul 24, 2015 7:38 am

You will probably have to lengthen the delay time to compensate for the Floor and Ceiling lower speed, otherwise the raise event happens too early afterwards.
Last edited by ARGENTVM on Fri Jul 24, 2015 7:38 am, edited 1 time in total.

Catastrophe
Retired Staff / Community Team Member
Posts: 2571
Joined: Sat Jun 02, 2012 2:44 am

RE: Scripts... what the hell!!!

#3

Post by Catastrophe » Fri Jul 24, 2015 8:21 am

instead of delay(1); use tagwait(45);

marcello
New User
Posts: 12
Joined: Mon Jul 13, 2015 5:53 pm

RE: Scripts... what the hell!!!

#4

Post by marcello » Fri Jul 24, 2015 9:11 am

While I was waiting I figured out:

script 8 (void)
{
{
Floor_LowerByValue(45,27,128);
Ceiling_LowerByValue(45,27,128);
Delay(1);
}
Delay(100);
{
Floor_RaiseByValue(45,27,128);
Ceiling_RaiseByValue(45,27,128);
Delay(1);
}
}

In this way it works. But I try tagwait right now! Tahnk you!

Catastrophe
Retired Staff / Community Team Member
Posts: 2571
Joined: Sat Jun 02, 2012 2:44 am

RE: Scripts... what the hell!!!

#5

Post by Catastrophe » Fri Jul 24, 2015 9:36 am

Np, also just letting you know, FloorAndCeiling_LowerByValue and FloorAndCeiling_RaiseByValue exists.
Last edited by Catastrophe on Fri Jul 24, 2015 9:37 am, edited 1 time in total.

Konda
Forum Regular
Posts: 487
Joined: Thu Jun 07, 2012 5:22 pm

RE: Scripts... what the hell!!!

#6

Post by Konda » Fri Jul 24, 2015 10:47 am

marcello wrote: While I was waiting I figured out:

script 8 (void)
{
{
Floor_LowerByValue(45,27,128);
Ceiling_LowerByValue(45,27,128);
Delay(1);
}
Delay(100);
{
Floor_RaiseByValue(45,27,128);
Ceiling_RaiseByValue(45,27,128);
Delay(1);
}
}

In this way it works. But I try tagwait right now! Tahnk you!
tagwait is more flexible because you won't have to change the delay if you decide to alter the raise/lower speed in the future.

Code: Select all

<Synert> fuck
<Synert> plugged in my memory stick and got a bsod

User avatar
Ivan
Addicted to Zandronum
Posts: 2229
Joined: Mon Jun 04, 2012 5:38 pm
Location: Omnipresent

RE: Scripts... what the hell!!!

#7

Post by Ivan » Fri Jul 24, 2015 12:13 pm

Nobody noticed this thread being in the wrong place? There's Editing Help section for these questions.
=== RAGNAROK DM ON ... uh... dead forever? ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===

Lycaon
 
Posts: 64
Joined: Tue Sep 23, 2014 4:04 am
Location: Argentina

RE: Scripts... what the hell!!!

#8

Post by Lycaon » Fri Jul 24, 2015 12:25 pm

the delay(x); thing counts tics, not seconds. 35 tics = 1 second

Fused
Contributor
Posts: 687
Joined: Sat Nov 09, 2013 9:47 am
Location: Netherlands
Contact:

RE: Scripts... what the hell!!!

#9

Post by Fused » Fri Jul 24, 2015 12:32 pm

Moved thread to the correct subforum.

Also, this is probably the best thing to do:

Code: Select all

script 8 (void){
    FloorAndCeiling_LowerByValue(45,27,128);
    Tagwait(45);
    Delay(35); //wait a second before actually moving up again.
    FloorAndCeiling_RaiseByValue(45,27,128);
}
Last edited by Fused on Fri Jul 24, 2015 12:33 pm, edited 1 time in total.
Image Image

Collaborate and join the community
Image Image

marcello
New User
Posts: 12
Joined: Mon Jul 13, 2015 5:53 pm

RE: Scripts... what the hell!!!

#10

Post by marcello » Sat Jul 25, 2015 6:54 am

Catastrophe wrote: Np, also just letting you know, FloorAndCeiling_LowerByValue and FloorAndCeiling_RaiseByValue exists.
Ah? ahahahaha! I didn't know it!!!
Konda wrote: tagwait is more flexible because you won't have to change the delay if you decide to alter the raise/lower speed in the future.
Thank you, didn't know "tagwait".
Lycaon wrote: the delay(x); thing counts tics, not seconds. 35 tics = 1 second
Ok, this information is very usefull.
Ivan wrote: Nobody noticed this thread being in the wrong place? There's Editing Help section for these questions.
Fused wrote: Moved thread to the correct subforum.
My apologies
Fused wrote: Also, this is probably the best thing to do:

Code: Select all

script 8 (void){
    FloorAndCeiling_LowerByValue(45,27,128);
    Tagwait(45);
    Delay(35); //wait a second before actually moving up again.
    FloorAndCeiling_RaiseByValue(45,27,128);
}
Works really great! Thank you everybody, I am very greteful, may I ask another question? If I want to change the brightness of a room, which script should I look for?

Fused
Contributor
Posts: 687
Joined: Sat Nov 09, 2013 9:47 am
Location: Netherlands
Contact:

RE: Scripts... what the hell!!!

#11

Post by Fused » Sat Jul 25, 2015 7:57 am

marcello wrote: If I want to change the brightness of a room, which script should I look for?
Light_Fade (tag, value, tics)
- tag: Tag of affected sector
- value: New light level
- tics: How long the light takes to fade to the new level

Since the thirth argument allows you to slowly fade to the desired brightness, a loop is not needed.
Image Image

Collaborate and join the community
Image Image

marcello
New User
Posts: 12
Joined: Mon Jul 13, 2015 5:53 pm

RE: Scripts... what the hell!!!

#12

Post by marcello » Sun Jul 26, 2015 6:57 am

Ok, and if I want to coordinate a sound with the lack of light I had first to define it in SNDINFO, then I had to use "A_PlaySound" function?

marcello
New User
Posts: 12
Joined: Mon Jul 13, 2015 5:53 pm

RE: Scripts... what the hell!!!

#13

Post by marcello » Sun Jul 26, 2015 12:04 pm

Nevermind, I don't need the answer anymore! SNDINFO, SNDSEQ, 80 script X (void) {Soundsequence ("myfile"); }

Thank you anyway!

Post Reply