Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Has set_sentence changed?

A topic by Garry Francis created Jul 03, 2020 Views: 126 Replies: 12
Viewing posts 1 to 2
Submitted

I'm testing my game and I could swear that commands that used to work due to reliance on set_sentence no longer work as they used to. In the past, after hitting a set_sentence statement, the parsing seemed to start over with the new sentence. Now it seems to continue on, so that statements that were previously skipped over are now executed. It used to work like a charm, now I have to change the sequence of all my code or remove set_sentence completely. Has this changed or am I just imagining things?

Host

set_sentence has not changed, but perhaps you remember using its predecessor submit_command (which works in the way you describe)?

Submitted

No, I've never used that. It was set_sentence. I'm now removing it, as it no longer works.

Host

You have used it.

20 days ago - https://itch.io/post/1532628

"If I use submit_command, there is a parameter stop_tick = "true". I imagine that serves the same purpose as the stop_tick statement. Correct?"

Furthermore, everything seems to be working well based on a test I just performed:

start_at = my_location
locations {
   my_location : location "You are in a room." ;
} on_command {
   : match "grab lamp"  {
      : set_sentence "get lamp";
   }
   : match "grasp lamp"  {
      : submit_command "get lamp" stop_tick = "false" ;
      : print "YYYYY" ;
      
   }
   : match "get lamp"  {
      : print "Getting lamp." ;
   }
}
on_tick {
   : print "tick()" ;
}
Submitted

That was hypothetical. I've never used it.

Submitted

My problem was that I had several instances of set_sentence statements inside if statements. After the set_sentence statement was executed, it would fall through and execute the statements outside the if statement and that caused all sorts of havoc. It wasn't previously doing that. Or maybe I dreamed it. And my set_sentence statements were adding a preposition and 2nd noun to allow for implicit actions. It was previously working like a charm. I've now had to remove all the implicit actions.

Host

I need an example bit of code to be able to evaluate and fix though.

I've done nothing in this area (as far as I'm aware )since I added set_sentence. It was designed to fall through.

submit_command is the one that submits a brand new command and re-executes on_command {} from the top (with or without an additional tick).

My own test code (posted) demonstrates how it's supposed to work, so I'd like to understand what you don't think is working via a code snippet.

Chris

Submitted

Don't worry about it now. I haven't got time to muck about with code snippets and I no longer have access to the old version, as I've updated to 42b. Once I've updated, I can't go back. Pity.

If it just falls through, then it's pretty pointless. You might as well just skip the set_sentence and do normal processing, albeit with extra if statements or setting flags or something.

Host

It falls through by design. I don't understand what you want it to do instead.

Let me know how you think it should act and I'll 100% review if it's possible via a parameter.

Submitted

Later. I'm only talking about how it used to work, not how I want it to work. I thought my game was working fine, but I've had to re-engineer some parts because it no longer works as it used to. Like I said, I might be mistaken. Maybe it never worked properly and I've only noticed it now because I'm testing, but I was so happy with the way it used to work that I was using it a lot to convert two-word input into multi-word input.

Host

OK, but make a copy of the code you expect should be working so I can take a look at it later.

Submitted

Too late. I've already overwritten it. But I can remember what it looked like. Basically something like:

: match "hit baddie" {
   : if (preposition_is "" && noun2_is "" && is_carried "thing") {
      : set_sentence "hit baddie with thing";
   }
   // Some other tests or statements
   : if (preposition_is "with" && noun2_is "thing") {
      // Do stuff
   }
}
Host

Also, I explained how set_sentence work here previously:

https://itch.io/post/1536616