Alright, I'm stumped.

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.
Locked
User avatar
ace
Posts: 787
Joined: Tue Jun 21, 2005 10:14 am
Location: Just south of the True North

Alright, I'm stumped.

Post by ace »

Normally I spend hours trying to figure out what a problem could be when something isn't working before consulting the forum. But I'm absolutely dumbfounded in this case.

I posted a long while back about how to make 3D silent teleporting elevators and once I figured it out, I made one flawlessly. The problem is that was six months ago and I've really fallen out of the groove on ACS. So I found that olde thread, found the example that was posted, and used that once more.

I'll be honest here: I'm not the greatest ACS scripter. While I can do some things that get me by (inefficiently nonetheless, such as using 500 lines of code where variables probably could have shortened it to 50), I honestly for the life of me can't begin to understand functions and when I attempted to make one that would work for a fan... well let's just not go there. So I shamelessly copied and pasted (which is what I did last time) the code for the elevator from the example, and then plugged in the script that activates the new function. It worked flawlessly for me last time. This time it was not the case.

I checked numerous times, and while the tags and structure of the elevators are different, they are exactly the same when it comes to the order of the tags, the function, and the script. However, flipping the switch that starts the elevator, rather than getting the ceiling and floor moving, makes the "floor/ceiling/lift has stopped moving" sound, meaning it is supposed to be going somewhere, but isn't.

I managed to recreate the situation from the buggered map perfectly, so as to hopefully get a better understanding of all of this. It's in the attachment.

And here is the code for it, essentially anyway, obviously the full map has more scripts than this but they are irrelevent anyway...
Spoiler:
Any ideas? Perhaps the scripting kings can enlighten me here... :p
Attachments
elevator.zip
Aaargh it's broked.
(7.61 KiB) Downloaded 24 times
User avatar
Risen
Posts: 5263
Joined: Thu Jan 08, 2004 1:02 pm
Location: N44°30' W073°05'

Post by Risen »

Just a guess, as I can't look at the map right now...

What's the travel distance? You're multiplying it by 8 in the DoVator call. So, any value 32 or above is going to cause problems, since you can still only pass a value up to 255 to the ACS functions.
User avatar
ace
Posts: 787
Joined: Tue Jun 21, 2005 10:14 am
Location: Just south of the True North

Post by ace »

Not sure what you mean, do you mean the distance the elevator travels from top to bottom? If that's the case it was definitely over 32. :?

I would have to lower it significantly if that's the case, and doing that doing that didn't work anyway. Removing *8 did not work either...

The only thing is that this worked flawlessly last time and it definitely went over a larger distance than 32. But seeing as I have no idea what causes this problem it could be completely irrelevent. :?

EDIT:
Interesting... rather than using variables, I plugged in numbers this time into the script, and it works all of the sudden!
Spoiler:
And changing the tag (speed, first, last, tag, direction, distance) to the top's tag and the direction to 1 works fine as well. Odd. I just don't understand for the life of me why it wouldn't work in this case then. But at least it's functional now.
User avatar
Risen
Posts: 5263
Joined: Thu Jan 08, 2004 1:02 pm
Location: N44°30' W073°05'

Post by Risen »

If you call script 1 like this:

acs_execute(1, 0, 9, 10, 32);

Then the script runs like this:
DoVator(16, 9, 10, 9, 10, 32*8);

which is the same as:
DoVator(16, 9, 10, 9, 10, 256);

Then, you come along to here:

FloorAndCeiling_LowerByValue (i, 9, 256);
but "dist" must be less than 256 here. If it is 256 or greater, you will get unexpected results.



when you change it to numbers:

16*8=128. 128 is less than 256 so it won't overflow.

Why are you multiplying it by 8 anyway?
User avatar
ace
Posts: 787
Joined: Tue Jun 21, 2005 10:14 am
Location: Just south of the True North

Post by ace »

Welp, it's working fine now. Thanks for the help.
Risen wrote:Why are you multiplying it by 8 anyway?
Meh. That's how it was in the example wad, it worked there, and it worked in the level I tried it in a while back, so I just went with it. But if I had to hazard a guess at it it'd probably be because Doom's height units go up/down by 8's by default, which would mean you don't have to be un-lazy enough to do math in your head or type "calc" in start->run. :p
User avatar
Phobus
Posts: 5984
Joined: Thu May 05, 2005 10:56 am
Location: London
Contact:

Post by Phobus »

Unless you are using my personal favourite floor/ceiling manipulation functions, which are Foor_Raise/LowerByValue and Ceiling_Raise/LowerByValue. They do any number, or at least any I've put in. (400, 13, 32, 128, all sorts).
User avatar
ace
Posts: 787
Joined: Tue Jun 21, 2005 10:14 am
Location: Just south of the True North

Post by ace »

Yes, I just mean that laziness would cause one dealing with multiples of 8 anyway to just multiply the number of times they click the "height down" button in DB under edit linedef by 8. Heh.
Locked

Return to “Editing (Archive)”