Locking a door in Inform7 works in one case but not another - inform7

Hoping there is someone active on this tag I will issue a problem regarding Inform7 here. We currently use this language in college to get in contact with the structure of splicing projects and tasks in a group.
The current task is to unlock a door when a button is pressed and close it after one turn. The code I use is the following:
doorOpen is a number which varies. doorOpen is 0. [ = false]
TuerK is a door. It is south of Flur006R and north of R028a. It is locked.
Tbutton_flur is in Flur006R. Tbutton_flur can be pushed.
Instead of pushing Tbutton_flur:
now TuerK is unlocked;
say "Die Tür öffnet sich";
now doorOpen is 2;
Every turn when doorOpen is 1:
now doorOpen is 0;
now TuerK is locked;
say "Door closes!".
Every turn when doorOpen is 2:
decrement doorOpen.
Tbutton_raum is in R028a. Tbutton_raum can be pushed.
Instead of pushing Tbutton_raum:
now TuerK is unlocked;
say "Door opens!";
now doorOpen is 2;
Where I use doorOpen as an attribute to check whether the door was open or not. Problem now is that I can push the button, go to the opened room, it says that the door is beeing closed, but I can go out of the room without any problems and it appears that it is unlocked from now on.
On the other hand I have other code:
TuerSiT is a door. It is south of R024 and north of Flur005R. It is locked.
The Sicherheitsausweis unlocks TuerSiT.
Before going to R024:
if player is holding Sicherheitsausweis:
now TuerSiT is unlocked;
say "Der Sicherheitsausweis hat die Tür entsperrt";
otherwise:
now TuerSiT is locked.
Where the now doorname is locked works totally fine.
Is there anything I did incorrectly? I also tried to create hidden keys to have the unlocked because that was where I thought the problem was, but it seems I am unable to lock the door.
Any help is much appreciated!

So it appears the one first has to close the door, which was something I did not test on the other door. So
now the door is closed;
now the door is locked.
works all fine.

Related

Prevent automatically entering the room on startup

I want to give the player a chance to select a few options on game startup, such as their name.
The only problem is that the game insists on putting the player into the first room immediately and print the room name and description. That's not interesting for the player yet, though.
How can I prevent Inform 7 from automatically putting the player into the first room, or at least suppress the room name and description printing at startup?
The solution I found:
The initial room is a room.
The first rule for printing the name of a room:
if the player is in the initial room:
do nothing;
otherwise:
continue the action.

CharacterController Collider Script issue

enter image description here
This script is supposed to End the game if Player hits something infront(z axis). But instead, the Player dies even if it hits anything in x and even y axis(which is ground) so game ends the moment my player touches the ground. Requesting help. I'm new to Unity and c#. So please don't abuse me if the solution is too obvious.
I think the player dies immediately because the ground also have a collider which the player touches. try to add a tag to the object in front the player, and in your code check the tag before calling the end game function.
if(hit.gameobject.tag == "tag" && hit.point.z > transform.position.z + controller.radius)
Death();

STM32F7 hangs after system reset

I have the following problem:
STM32F7 Flash starts at 0x0800 0000. My program works fine.
Then I shift my code in FLASH at 0x0802 0000 to leave space for future bootloader. I changed my MemoryMap.xml file :
<MemorySegment start="0x08020000" name="FLASH" size="0x80000" access="ReadOnly"/>
and the corresponding flashplacement.xml file:
<ProgramSection alignment="0x100" load="Yes" name=".vectors" start=" 0x8020000"/>
and start debuging....Program works fine until an link error occurs which triggers a system restart with a call of HAL_NVIC_SystemReset.
The result is a hanging application which is not the case when my code resides at the start of FLASH (0x0800 0000)
Does anybody knows why is this happens?
Regards
/Kostas
The answer is rather easy. You cant just move memory start address. Your micro will get the stack pointer value and the reset handler routine address from the same address as usually. You need to have this boot loader already flashed( at least the vector table and the reset handler which will set the new vector table, set the app stack pointer and pass the control to your app reset handlet

How do I restart the current room to what it was when the player entered it?

While making a game, I had set it up so when the player dies, the game resets. Feeling this was a bit too harsh, I did some research and found the room_restart() code, which is meant to restart the current room. But, when I input it and triggered it via dying, it did not reset the room to how it was. How do I reset it?
{
room_restart()
}
That is the code that triggers on collision with an enemy.
You would have to record the state somehow. Game Maker has a native state save function, but if you wanted a room to stay the same without changing the player's inventory or something, you'd have to manually record the state of every object in it so when the player leaves and comes back, everything resumes where it was.
You could try having each object record important variables to a file with sections for each room. For instance, you could use a JSON file with sections for each room, and each object would record their vital data into that section. For example:
{
"rmHouse": {
"Mom": {
"x": 64,
"y": 128,
"action": "lookingDown"
}
}
}
Check around for Game Maker JSON extensions. Here's one for GM8.1/Studio: http://gmc.yoyogames.com/index.php?showtopic=565659
room_goto(room);
That will send the room back to how it was when you first entered it, but room_restart should do the same.
Make sure that you do not have "persistent" checked in the room options. That's what sounds like it's probably the issue to me.
If you had
if(health = 0) {
instance_destroy();
}, then delete instance_destroy. Replace it with x = 32
y = 64
health = max_hp
restart_room();
so that the X position is set, the Y position is set, the health is back, and the room restarts.

set softkeys on qt for symbian

On E63 or similar smart phones,there can be three softkeys(the left and right one always named "OK" or "Cancel" and the middle one always named "Select" or 'Query" alike actions' name) on the screen.QAction has this method:
void setSoftKeyRole ( SoftKeyRole softKeyRole )
,and SoftKeyRole goes these descriptions:
QAction::NoSoftKey 0 This action should not be used as a softkey
QAction::PositiveSoftKey 1 This action is used to describe a softkey with a positive or non-destructive role such as Ok, Select, or Options.
QAction::NegativeSoftKey 2 This action is used to describe a softkey with a negative or destructive role role such as Cancel, Discard, or Close.
QAction::SelectSoftKey 3 This action is used to describe a role that selects a particular item or widget in the application.
I have used PositiveSoftKeys and NegativeSoftKey to set the left and right softkey,but I can never do SelectSoftKey to the middle one?I found nothing related to this on qt bug repository.What I want to do is make full use of the three softkeys on most smartphones.Can anybody figure out what happened?Thanks always.
E63 does not have a touch screen,and it seems only smart phones with a touch screen(Nokia series) can set SelectSoftKey to the middle one.

Resources