Multireplace Error

My turn to ask for help in figuring out an error:

This is my code:

Hi @{chutemr "trash"|"bodies"|"skullchute"}. This is a test.

This is the first error I got in Quicktest:

Error: crypt_level line 670: invalid @{} at letter 1; ‘chutemr’ is equal to 0 which is not a positive number

These are the steps I have taken to resolve this error:

  • verified the variable “chutemr” was created with 0 in the start-up file
  • verified the variable “chutemr” was set to a value of: 1,2, or 3 in a later file.
  • verified the variable “chutemr” registers a value of 1,2, or 3 after being set
  • Rewritten the code, thinking that there might be a hidden character or something I was not seeing.

After rewriting the code, I got the following error:

Error: crypt_level line 670: invalid @{} at letter 4; ‘chutemr’ is equal to 0 which is not a positive number

These are the steps I’ve taken trying to resolve this error:

  • verified the variable “chutemr” was created with 0 in the start-up file
  • verified the variable “chutemr” was set to a value of: 1,2, or 3 in a later file.
  • verified the variable “chutemr” registers a value of 1,2, or 3 after being set

I do not think rewriting will resolve whatever my real underlying problem is, and I do not have any further ideas to try… so I come to you all, hoping someone has an idea or solution I don’t.

I have 4 different multireplace variables and use the same code, just replacing variables as needed elsewhere. Never encountered an issue before, using multireplace.

Also, I tried moving the code to another place in the file, but that changes nothing either.

Any help would be appreciated.


Is that @{} on the stats page? Quicktest will always go to the stats page, including during the first page

edit: sorry, after looking again, it looks like it’s in a different scene

1 Like

No, it is in a scene file.

I’m in the middle of a meeting and never actually used multi replace. However…

I know that you checked the variable was set correctly when you set it. But when you run the code, is it definitely being set before you run the multi replace?

The first thing I would do is print the value of the variable one line above where you have the multi replace (and comment out the multi replace). This will confirm that the variable is actually set correctly at the point you want to use it.
Not sure if you have done that already in your tests.


Confirmed … and commenting the code alone also allows Quicktest to pass.

You could try setting up a new project and just putting the create variable and the multireplace line in the startup.

If it doesn’t run, there’s something wrong in the code there.

If it does run, then it’s getting spooky. You’ll probably need to share more code as it’ll likely be a weird interaction somewhere.


This is weird … I replace the variable with any of my other multireplace variables and Quicktest passes… the only failure is with that variable

You don’t have two similarly named variables and you’re setting and calling them interchangeably?

I think if you can’t get it to work in a fresh project with just that code, then you may need to share more code

1 Like


The variables that work are:

  • victimmr
  • ragdollmr
  • attitudemr

I will try a “fresh” project

I haven’t used a numeric variable in multi replace command before (so I don’t think I can help), but I will be following this in case something like this happens to me in the future!

1 Like

Here is my simple testproject code (which passes), using the code I used in my main project

 Is this the chute you decide to flee through?
 *label chooseagainone
     # Yes
         *set chutemr 1
         *page_break [i]Indecision...[/i]
         *goto labelten
     # No
         *page_break [i]Indecision...[/i]
         *goto chooseagainone

*label labelten

Hi @{chutemr "trash"|"bodies"|"skullchute"}. This is a test. 


This works perfectly


Here is the code in the main project in scene one:

Is this the chute you decide to flee through?
            # Yes
                *set chute 1
                *set chutemr 1
                *page_break [i]Indecision...[/i]
                *goto labelten
            # No
                *page_break [i]Indecision...[/i]
                *goto chooseagainone

and the problem code in scene2

*page_break [i]Confrontation[/i]

Opening the door wide before you, you find yourself entering a circular room hewn from the same bedrock the rest of the catacombs are. 

The walls of this room are plastered and entirely covered with frescoes that had cracked and peeled long ago. Arranged in a semicircle against the circular walls facing you, are various couches of the ancient style, the couches that ancient royalty and nobles used to recline on as they feasted. 

Unlike the frescoes on the wall, these seem unusually well preserved and in a somewhat immaculate condition. In the center of the room is a stone spiral staircase, leading down into the depths of the catacombs.

It isn’t the frescoes nor the couches that capture your attention but rather the people - children really - all of whom are staring at you in various states of curiosity, apprehension and even amazement.

Hi @{chutemr "trash"|"bodies"|"skullchute"}. This is a test.

I can’t get to a computer right now to play with it.

If you choose no, do you go back to that same choice? Or is there an initial choice where you pick from 3 and then get the ‘are you sure?’ Choice you have there?
It makes me wonder if there is an unintended path where you can fall through to scene 2 without picking an option that sets chutemr?

Are you testing this manually or just with quick test?
If you go to it manually and pick one option and then click yes, does it fail? In fact, check manually with all three options.

1 Like

Tis is quicktest which is failing

I did run the game and all three main choices and the embeded confirm choice work normally.

It is an embeded choice, but I’ve not had any issues before with the variables not working properly…

I did not run the game manually to the problem code because it is 50,000 more words into the game.

With that said, I did try this code as a workaround right before the problem code:

*if (chutemr = 1)
    *set ragdollmr 1
*elseif (chutemr = 2)
    *set ragdollmr 2
    *set ragdollmr 3

and then used this:

Hi @{ragdollmr "trash"|"bodies"|"skullchute"}. This is a test.

This passes Quicktest

So it seems like

should not be an issue, because the if,elseif changes the second variable correctly.

This is very weird, and I’m going to use the work-around for now… i’ve been at this too long for the night.

@Sinnie — Thank you very much for taking the time and effort here.


1 Like

It does look like there is an unintended path somewhere, as we can both confirm the code itself runs correctly independently AND switching out the variable makes it work - so the multireplace itself should be fine. This means that the error is 99% in the setting of the variable, which suggests there is somehow a path to that scene whereby the variable is not set correctly.

Without seeing your full code it’s hard to unpick fully.

I would suggest running it through manually. The ‘expected’ flow is something like:
Pick chute (set chutemr to 1/2/3) → Are you sure? → Yes → Multireplace using 1/2/3 OR
Are you sure? → No → Pick chute (set to 1/2/3) → Are you sure? → Yes → multireplace using 1/2/3

By running those 12 scenarios (3 x Yes, 9 x No then pick each of the three options) manually, you can confirm if there are routes that work and routes that do not. I would anticipate that you will have a mix (or even just one that does not work).

To quickly test manually, just add a shortcut to the right scene. If you only need a few variables set, just jump right to the scene that sets them.

I would also add a print for the variable, to confirm that it is the value you expect. Might be worth creating a dummy page which just prints the variable on screen and then goes to the scene with the multireplace (that way if it errors, you see the value before it hits the error).

1 Like

Simple curiosity: What does ${chutemr} print to?
I have a feeling that quicktest bypasses certain things so your chute is zero and still passes all the way to the error part.

1 Like

I tried sending it to both stats and to the current ending page… did I test this part wrong?

Is that to me? I’m afraid I don’t quite follow.

Sorry, I am still digesting your post. It has now entered “complicated” for me, and I am not very good at coding :slight_smile:

I totally follow that a hidden path maybe the issue (and probably is)… I just get lost in the manually testing part… so learning how to make shortcuts and test them is next for me tomorrow after I rest a bit.

Edit: The stupid system software edits my posts to remove quotes … sometimes i forget to manually revert the posts.

No problem. I’ll try and pull together something later on to help you navigate it when you come back to it tomorrow.

1 Like

Right, QuickTest “cheats” and will try to run code that actually can’t ever happen in a standard game run. It’s actually rather annoying, and I often rely solely on random test because of this.

I don’t have time right now to look at this in detail, but it’s very likely that your default value for the variable is 0, change it to something that multireplace likes (and adapt the rest of your code to compensate, if necessary).