Issue824

Title MO-HFGateAccessServer dialog won't proceed3 due to lua error
Priority important Status postponed
Assigned To Keywords
Linked issues Watchers

Submitted on 2015-06-20 20h12 by ferrisBueller, last changed by jesusalva.

Messages
Author: ferrisBueller Date: 2015-06-20   20h12
In hell fortress, MS Office, there is a terminal that is used to chat with
Spencer and then to open the power unit gates.
After the chat with spencer the menu shows up the following actions:
  status
  logout

When clicking "status" in the dialog screen there is only printed "-status" in
red font and Nothing more happens (i.e. no gate status is displayed and no more
actions appear).

When doing this the following message is printed in the (real) console:

---------------------------------------------------------------------------------
FreedroidRPG 0.15.1 encountered a problem in function:  run_lua 
Error running Lua code: ../map//script_helpers.lua:150: Obstacle number 132 does
not have any states defined..
Erroneous LuaCode={
2 	tux_says(_"status", "NO_WAIT")
3 	if (cmp_obstacle_state("HF-Gate-outer", "opened")) then
4 		npc_says(_"Gate 1 status: OPENED", "NO_WAIT")
5 	else
6 		npc_says(_"Gate 1 status: CLOSED", "NO_WAIT")
7 		if (not has_cookie("MO-HFGAS_hacked")) then
8 			show(2)
9 		end
10 	end
11 	if (cmp_obstacle_state("HF-Gate-inner", "opened")) then
12 		npc_says(_"Gate 2 status: OPENED", "NO_WAIT")
13 	else
14 		npc_says(_"Gate 2 status: CLOSED", "NO_WAIT")
15 		if (not has_cookie("MO-HFGAS_hacked")) then
16 			show(2)
17 		end
18 	end
19 	if (cmp_obstacle_state("HF-Gate-inner", "opened")) and
20 	   (cmp_obstacle_state("HF-Gate-outer", "opened")) then
21 	end
}

If you encounter this message, please inform the FreedroidRPG developers about it
You can 

  send an e-mail to                    freedroid-discussion AT lists.sourceforge.net
  mention it on our IRC channel        #freedroid on irc.freenode.net
  post on our forum at                 https://sourceforge.net/apps/phpbb/freedroid
  or report the bug on our tracker at  http://bugs.freedroid.org/

Thank you!

The problem mentioned above is not fatal, we continue the execution.
---------------------------------------------------------------------------------

I guess the error is the reason for the behaviour described above. Is there some
fix or workaround available?

Cheers
Ferris
Author: jesusalva Date: 2015-06-20   22h27
Well, ignoring the main problem here, we 
should try to continue ignoring the code 
and/or/except display "node99" (It's good 
to have an universal exit node for 
failure). We can also quit the dialog 
without jumping to any node, which 
dependong on the situation will make 
clear that something happened.

Now, back to main problem ... If I 
understood correctly, the onstacle 
doesn't exists, which imo makes this a 
release-blocker.
You can use the cheat level editor to 
plant it again, or append it here for 
further analysis by other devs.

Hope to have been useful, regards from 
colden brazilian metropolis.
Jesusalva
Author: jesusalva Date: 2015-06-20   22h28
By "append it here" i meant the save 
file.
Author: ferrisBueller Date: 2015-06-22   21h27
Thank you for your advice, jesusalva.
I played around a bit and - finally - I managed to work around the bug. But I
don't understand clearly why.

As a first attempt I looked up the gate labels in the level editor. They seemed
to be set correctly (they also appeared in the map/levels.dat).
I thought, the error must be caused by a wrong obstancle ID. The error complaied
about a missing obstacle ID '132' (resp. '66') which isn't listed in
map/script_helpers.lua. So I simply added two list elements with ID '66' and
'132' with an "opened"/"closed" pair. I don't know what the status IDs mean, so
I tried some out.
=> The terminal dialog worked correct that way, but the gates still didn't open.
Instead some strange things happened - walls next to the gates turned into open
gates etc. So this wasn't the right approach.

As a second attempt I followed Jesus' advice. First I deleted the gate labels
and tried out what happened in this configuration:
=> The game crashed when I clicked the "-status" action in the gate access
terminal. This message was printed in the console:
---------------------------------------------------------------------------------
FreedroidRPG 0.15.1 encountered a problem in function: 
give_pointer_to_obstacle_with_label 
Obstacle label "HF-Gate-outer" was not found on the map.
...
---------------------------------------------------------------------------------
Then I re-planted the gate labels. When diffing the map/levels.dat with the
original version it seemes to be the same as before (only the two label entries
appear some lines below their original position). But ...
=> This configuration now works perfectly (terminal dialog works + gates get
opened)!

If anyone wants some of my files for further examination, just let me know.

The sad thing is, I don't know how to transfer the change to my active hero's
shp file. I renamed the MapEd.shp for test.

Cheers, Ferris
Author: ferrisBueller Date: 2015-06-22   22h28
... alright - gEdit is capable to edit and save shp files. So for me the problem
is solved for now.
Ferris
Author: jesusalva Date: 2018-04-17   11h45
Marking as postponed, this is an old and obscure bug, and there was no further 
cases of it.

If this still happens, please mark status as open so it may be investigated.
There's also the chance that the obscure bug was squashed in a random commit by 
accident, so please consider closing the ticket.

Jesus Saves
History
Date User Action Args
2018-04-17 11:45:44jesusalvasetstatus: open -> postponed
messages: + msg3566
2017-12-24 17:49:53jesusalvalinkissue890 linked
2015-06-22 22:28:12ferrisBuellersetmessages: + msg3201
2015-06-22 21:27:26ferrisBuellersetmessages: + msg3200
2015-06-20 22:28:58jesusalvasetmessages: + msg3199
2015-06-20 22:27:31jesusalvasetmessages: + msg3198
2015-06-20 20:12:04ferrisBuellercreate