Custom Map #1319: FPS: Ported Over. By: qople

Started by AutoPost, April 12, 2021, 06:32:10 PM

Previous topic - Next topic

Ramlock

Quote from: mechi on June 25, 2021, 01:24:05 PM
I have no idea how to play this map. No description ingame or forum. Read about a portal gun in above bug report but I cannot scroll to said weapon nor select using keys. I can get a sound when standing on number 4 gate but nothing else. What am I supposed to do? (edit: sleepy)

I can confirm I'm also unable to play the map. Maybe a recent update to the game broke the scripts for this map?

heritor

Okay, so far I can confirm that the error isn't in PlayerTravel.4rpl - it plays the sound, creates the Animator unit, and stops the sound successfully, so that part works
I'm currently trying to see if I can debug Portal animator.4rpl - there's something in the :Awake code that's causing it to break.

It looks like removing the initial if/else/endif condition (if(<-portalIn lt0 Self GetUnitType 0 GetUnitsByType GetListCount ||)) makes it work, but tbh I don't know why.

Pro wrestler, graphic designer, video editor, programmer, cat daddy, game designer - I'm more caffeine than man.

CS Z

Quote from: heritor on July 04, 2021, 10:24:25 AM
Okay, so far I can confirm that the error isn't in PlayerTravel.4rpl - it plays the sound, creates the Animator unit, and stops the sound successfully, so that part works
I'm currently trying to see if I can debug Portal animator.4rpl - there's something in the :Awake code that's causing it to break.

It looks like removing the initial if/else/endif condition (if(<-portalIn lt0 Self GetUnitType 0 GetUnitsByType GetListCount ||)) makes it work, but tbh I don't know why.

If that's really the 4RPL, then that line of code looks inverted from what the code should be.  GetListCount is missing an item on the stack.  What is it supposed to be counting?  Probably the result from GetUnitsByType.  But GetUnitsByType is also missing an item on the stack.  What is it supposed to be retrieving?  Probably the unit matching ID 0.  Same thing for "Self GetUnitType" but there's a problem here since it would be saying the current unit exists (true) OR if a unit with ID 0 exists (also probably true) so there's a missing conditional like an 'eq'.  The stack would therefore be empty at the point of doing "<-portalIn lt0" which is an error.  It's amazing the code compiled let alone functioned in the first place.  I think someone got confused when they were writing it and it just happened to work.  Methinks 4RPL got patched to be more stringent about stack errors (a generally good thing) in the latest release but still didn't give us the much needed tools to debug 4RPL in CPACKs in a console.  :(

cornucanis

#18
Quote from: CS Z on July 04, 2021, 10:56:39 AM
Quote from: heritor on July 04, 2021, 10:24:25 AM
Okay, so far I can confirm that the error isn't in PlayerTravel.4rpl - it plays the sound, creates the Animator unit, and stops the sound successfully, so that part works
I'm currently trying to see if I can debug Portal animator.4rpl - there's something in the :Awake code that's causing it to break.

It looks like removing the initial if/else/endif condition (if(<-portalIn lt0 Self GetUnitType 0 GetUnitsByType GetListCount ||)) makes it work, but tbh I don't know why.

If that's really the 4RPL, then that line of code looks inverted from what the code should be.  GetListCount is missing an item on the stack.  What is it supposed to be counting?  Probably the result from GetUnitsByType.  But GetUnitsByType is also missing an item on the stack.  What is it supposed to be retrieving?  Probably the unit matching ID 0.  Same thing for "Self GetUnitType" but there's a problem here since it would be saying the current unit exists (true) OR if a unit with ID 0 exists (also probably true) so there's a missing conditional like an 'eq'.  The stack would therefore be empty at the point of doing "<-portalIn lt0" which is an error.  It's amazing the code compiled let alone functioned in the first place.  I think someone got confused when they were writing it and it just happened to work.  Methinks 4RPL got patched to be more stringent about stack errors (a generally good thing) in the latest release but still didn't give us the much needed tools to debug 4RPL in CPACKs in a console.  :(

It looks like GetUnitsByType is using the result of Self GetUnitType as the type i.e. it's counting the number of units with the same type as the unit running this script. GetUnitType is provided the UID Self so there's no problem there, and GetUnitsByType is provided a unit type as well as an int. Finally, GetListCount is checking the length of the list returned by GetUnitsByType. Thus I don't see any issue with the order of things on the stack, unless I'm somehow looking at this wrong.

The thing that seems odd to me is the fact that it's using GetUnitsByType with its own unit type. It seems like this should always return true, since if the unit exists to run the code in the first place it will always be the unit found of its own type?


(edited to fix formatting fail)


CS Z

Quote from: cornucanis on July 04, 2021, 04:10:11 PM
Quote from: CS Z on July 04, 2021, 10:56:39 AM
Quote from: heritor on July 04, 2021, 10:24:25 AM
Okay, so far I can confirm that the error isn't in PlayerTravel.4rpl - it plays the sound, creates the Animator unit, and stops the sound successfully, so that part works
I'm currently trying to see if I can debug Portal animator.4rpl - there's something in the :Awake code that's causing it to break.

It looks like removing the initial if/else/endif condition (if(<-portalIn lt0 Self GetUnitType 0 GetUnitsByType GetListCount ||)) makes it work, but tbh I don't know why.

If that's really the 4RPL, then that line of code looks inverted from what the code should be.  GetListCount is missing an item on the stack.  What is it supposed to be counting?  Probably the result from GetUnitsByType.  But GetUnitsByType is also missing an item on the stack.  What is it supposed to be retrieving?  Probably the unit matching ID 0.  Same thing for "Self GetUnitType" but there's a problem here since it would be saying the current unit exists (true) OR if a unit with ID 0 exists (also probably true) so there's a missing conditional like an 'eq'.  The stack would therefore be empty at the point of doing "<-portalIn lt0" which is an error.  It's amazing the code compiled let alone functioned in the first place.  I think someone got confused when they were writing it and it just happened to work.  Methinks 4RPL got patched to be more stringent about stack errors (a generally good thing) in the latest release but still didn't give us the much needed tools to debug 4RPL in CPACKs in a console.  :(

It looks like GetUnitsByType is using the result of Self GetUnitType as the type i.e. it's counting the number of units with the same type as the unit running this script. GetUnitType is provided the UID Self so there's no problem there, and GetUnitsByType is provided a unit type as well as an int. Finally, GetListCount is checking the length of the list returned by GetUnitsByType. Thus I don't see any issue with the order of things on the stack, unless I'm somehow looking at this wrong.

The thing that seems odd to me is the fact that it's using GetUnitsByType with its own unit type. It seems like this should always return true, since if the unit exists to run the code in the first place it will always be the unit found of its own type?


(edited to fix formatting fail)

4RPL is read from right to left (with the exception of parenthesis).  There's nothing on the stack for GetListCount to consume, which is just the start of the problems with that line of code.  The code is written backwards from what was likely intended and it is missing a comparison operator somewhere.  Honestly, this type of mistake is super easy to make and I've done it myself plenty of times since the compiler can't catch the errors due to how the language is designed and there isn't a console to debug runtime level CPACK issues like this.  You have to either spot it by accident, have a different/fresh pair of eyes staring at it (how do you share/partially publish a map in progress?), or export the code and figure out a way to test it in an external, non-CPACK test file with the in-game editor console, which isn't easy to do with custom units.

Xorgye

So... I like to play this map. But I don't know how to use the portals.
It isn't told me what to do, and stepping on them doesn't work.

Is it still possible to play this map? Do I have to do something first?

CS Z

Quote from: Xorgye on July 06, 2021, 10:22:00 AM
So... I like to play this map. But I don't know how to use the portals.
It isn't told me what to do, and stepping on them doesn't work.

Is it still possible to play this map? Do I have to do something first?

To play this specific map currently, which has bugs in the 4RPL that prevent the map from being played in the latest version of the game, you'll probably need to downgrade to version 1.4.8 first.  If you use Steam, you can downgrade using the "Beta switcher" in the settings for the game from within Steam.

Fabio pen

It doesn't work for me, I get stuck in the starting location, I can't enter the portal or create a portal

JayS


JayS

Quote from: CS Z on July 06, 2021, 11:03:56 AM
Quote from: Xorgye on July 06, 2021, 10:22:00 AM
So... I like to play this map. But I don't know how to use the portals.
It isn't told me what to do, and stepping on them doesn't work.

Is it still possible to play this map? Do I have to do something first?

To play this specific map currently, which has bugs in the 4RPL that prevent the map from being played in the latest version of the game, you'll probably need to downgrade to version 1.4.8 first.  If you use Steam, you can downgrade using the "Beta switcher" in the settings for the game from within Steam.

I just tried downgrading to 1.4.8 - I can confirm this works! Thank you!

jaworeq

Can this information be edited into map's description? It's fairly high on the list when you sort by thumbs and I just lost like 20 minutes trying to figure it out as well, before seeing info that I need to downgrade game

Karsten75

#26
Quote from: jaworeq on August 24, 2022, 08:55:19 AM
Can this information be edited into map's description? It's fairly high on the list when you sort by thumbs and I just lost like 20 minutes trying to figure it out as well, before seeing info that I need to downgrade game

It's really not possible to edit metadata for a map. What can be done is if you (and a few others) add a tag to it. I suggest "Need V148"


Durikkan

To clarify, a full fix is to change the line mentioned above to
if(<-portalIn lt0 Self GetUnitType 0 GetUnitsByType GetListCount 1 gt ||)
There was an issue caused by it expecting what was thought to be a quirk and later decided to be a bug, where unit counts aren't updated until after awake.  It checks to make sure there's no other portal animators, and after that patch, it would find itself and abort. 
I'm known as Auri in cw4.

knucracker

I've hopefully addressed this issue.  See here: https://github.com/KnuckleCracker/CW4-bug-tracker/issues/1062
Thanks for everyone that analyzed the problem and figured it out.  I didn't do anything but implement the solution you figured out, so the fix credit goes to those above.