Major unknown Elevator Problem

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Ghost214
Posts: 4
Joined: Sun May 27, 2012 9:58 am

Major unknown Elevator Problem

Post by Ghost214 »

I'm working on making a 10 level Doom "game" in a sense with at least 3 - 5 pages of script, but my first script has a problem with it. I'm familiar with the ACS scripting structure. I've used the elevator script many times (at least 5 different times) without any errors (except hitting the switch inside the elevator to make it move), and I've tagged everything correctly (Elevator switches tagged 1, 2, and 3. elevator sector tagged 1, etc..) but when I go to test the script, I have to constantly hit the switch to the elevator, and it doesn't bring it down, just the texture. Now this is the first time this has happened to me before and I've not a clue as to what's wrong or how to fix it. The script is as follows:

#include "zcommon.acs"
int floor;
script 1 (void)
{
if(floor==1)
{
elevator_lowertonearest (1, 16);
floor=0;
}
else
{
elevator_raisetonearest (1, 16);
floor=1;
}
}
script 2 (void)
{
elevator_movetofloor (1, 16);
floor=0;
}
script 3 (void)
{
elevator_movetofloor (1, 16);
floor=1;
}
User avatar
ChronoSeth
Posts: 1631
Joined: Mon Jul 05, 2010 2:04 pm
Location: British Columbia

Re: Major unknown Elevator Problem

Post by ChronoSeth »

Please use

Code: Select all

this format
and copy your code with indents. It's unreadable as it is.
scifista42
Posts: 23
Joined: Fri May 18, 2012 8:30 am
Location: Czech Republic

Re: Major unknown Elevator Problem

Post by scifista42 »

I also had problems with elevator functions. I solved it by replacing elevator function with functions Floor_lowerbyvalue() and Ceiling_lowerbyvalue(), or Floor_raisebyvalue() and Ceiling_raisebyvalue().
Ghost214
Posts: 4
Joined: Sun May 27, 2012 9:58 am

Re: Major unknown Elevator Problem

Post by Ghost214 »

Scifista42, could you show me how you used those functions, please?
User avatar
cocka
Posts: 1520
Joined: Sat Jul 02, 2011 7:21 am
Location: Hungary

Re: Major unknown Elevator Problem

Post by cocka »

Well, this code doesn't tell us too much, because we don't see the map including the code and we don't even know what you would like to do.
Ghost214
Posts: 4
Joined: Sun May 27, 2012 9:58 am

Re: Major unknown Elevator Problem

Post by Ghost214 »

Ok, cocka, I would like to fix this problem so it won't happen again. I've tried everything and nothing worked. I've torn it apart millions of times and nothing worked, I asked my friend what's wrong with it (since he knows more about the scripting than I do), and not even he knows what's wrong with it.
User avatar
Blox
Posts: 3728
Joined: Wed Sep 22, 2010 9:35 am
Location: Apathetic Limbo

Re: Major unknown Elevator Problem

Post by Blox »

Ghost214 wrote:I've tried everything and nothing worked.
You've even tried making a bug report with an example map with the bug occurring? Whoah, I didn't even notice!
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Major unknown Elevator Problem

Post by NeuralStunner »

Dude, you've been asked to provide an example map so we have something to actually work with. Help us help you.
User avatar
Sarah
Posts: 551
Joined: Wed Sep 06, 2006 12:36 pm
Preferred Pronouns: She/Her
Operating System Version (Optional): Debian 11 (bullseye), Windows 10
Location: Middle of Nowheresville Il.
Contact:

Re: Major unknown Elevator Problem

Post by Sarah »

Ghost214 wrote:

Code: Select all

#include "zcommon.acs"

int floor;

script 1 (void)
{
     if(floor == 1)
     {
          elevator_lowertonearest (1, 16);
          floor = 0;
     }

     else
     {
           elevator_raisetonearest (1, 16);
           floor = 1;
     }
}

script 2 (void)
{
     elevator_movetofloor (1, 16);
     floor = 0;
}

script 3 (void)
{
     elevator_movetofloor (1, 16);
     floor = 1;
}
Ok, so now that the script is a bit more readable, here's my thought. Your script 1 is checking to see if the variable "floor" is equal to 1. However notice that you only declared the variable and did not give it a value. Try changing it to this:

Code: Select all

#include "zcommon.acs"

int floor = (insert value here);

...rest of the ACS
Hope that helps :) Without a map I can't tell you exactly what number to plug in and I assume it would depend on where the elevator is at the start of the level.
User avatar
cocka
Posts: 1520
Joined: Sat Jul 02, 2011 7:21 am
Location: Hungary

Re: Major unknown Elevator Problem

Post by cocka »

int floor; is the same as int floor = 0;
User avatar
Sarah
Posts: 551
Joined: Wed Sep 06, 2006 12:36 pm
Preferred Pronouns: She/Her
Operating System Version (Optional): Debian 11 (bullseye), Windows 10
Location: Middle of Nowheresville Il.
Contact:

Re: Major unknown Elevator Problem

Post by Sarah »

Maybe I'm wrong. However in my experiences, "int x;" is usually given a value at some point within a script. Therefore in this case it would seem that giving a value to "int floor;" is what needs done. Again, maybe I'm wrong but it would be something I would try if my scripts were not working correctly.
User avatar
cocka
Posts: 1520
Joined: Sat Jul 02, 2011 7:21 am
Location: Hungary

Re: Major unknown Elevator Problem

Post by cocka »

OK, I just said that if you declare a variable in that way: int something; then you make zdoom print the value of it, the return value will be 0.
Ghost214
Posts: 4
Joined: Sun May 27, 2012 9:58 am

Re: Major unknown Elevator Problem

Post by Ghost214 »

Here's the map. I don't know how much this will help, but I want to fix this thing. I haven't done anything with the map as of yet because the problem angered me to much that I quit it until I can find some help on why it's not working the way it should.
Attachments
Something.wad
(36.65 KiB) Downloaded 24 times
User avatar
Kappes Buur
 
 
Posts: 4177
Joined: Thu Jul 17, 2003 12:19 am
Graphics Processor: nVidia (Legacy GZDoom)
Location: British Columbia, Canada
Contact:

Re: Major unknown Elevator Problem

Post by Kappes Buur »

It can be confusing :)
Spoiler:
Last edited by Kappes Buur on Wed Jul 11, 2012 10:51 am, edited 1 time in total.
User avatar
cocka
Posts: 1520
Joined: Sat Jul 02, 2011 7:21 am
Location: Hungary

Re: Major unknown Elevator Problem

Post by cocka »

Or just download this:
Something2.wad
(36.84 KiB) Downloaded 30 times
Locked

Return to “Editing (Archive)”