Using *temp

I’m having trouble with the *temp, i try using after a choice in the startup.

The error I’m getting is: startup line 114: Non-existent variable ‘blessings’
My code looks like this:
text my code is this:
*temp Blessing_text
*if Blessings = 0
*set Blessing_text “No blessing”
*goto chart
*elseif Blessings = 1
*set Blessing_text “Minor blessing (axe proficiency)”
*goto chart
*else
*set Blessing_text “Blessing (axe proficiency)”
*goto chart
*label chart
*stat_chart
text Blessing_text Blessings
*set Blessings = 1
im getting this from the example Hosted game tutorial give (look like they take it from choice of dragon). I just want make this line appear in the stats screen after a choice, this line “Minor blessing (axe proficiency)” something like an inventory where i can check, add, remove item from it after a choice and appear in stats screen.
I

*temp creates a variable that will only exist in the scene file itself and will dissappear once the scene file is switched. Since your code is a stat page code, you should probably add blessings as a variable in the startup.txt file and just call the necessary ones in stat page.

I’d do it like that:

In startup.txt

*create blessings 0

In stat screen:

if blessings =0
No blessings.
if blessings =1
Minor blessing (axe proficiency).
if blessings =2
Blessing (axe proficiency)

With this code your stat page will use startup variable that will always exist in the code, not *temp that dissappears after the scene transition.

ok i added this in startup: *create blessings 0
and this in stats:
*if Blessings = 0
*set Blessing_text “No blessing”
*goto chart
*elseif Blessings = 1
*set Blessing_text “Minor blessing (axe proficiency)”
*goto chart
*else
*set Blessing_text “Blessing (axe proficiency)”
*goto chart
*label chart
*stat_chart
text Blessing_text Blessings

Ok, if i do that it not blessing_text blessings anymore but i dont know what it change to.

it give me this error: “choicescript_stats line 2: Invalid expression at char 11, expected OPERATOR, was: NUMBER [0]”

if i use the same code but just change create and move the if part to start file: *create blessing_text blessings
This give me the error: startup line 30: Invalid create instruction, value must be a number, true/false, or a quoted string: blessing_text blessings

So i try to put “” around blessings like this: *create blessing_text “blessings”
then it give me "choicescript_stats line 2: Non-existent variable ‘blessings’
that line is the start of the if line: *if Blessings = 0

Should i just scrap this and anybody has an inventory added text code for me to “borrow” and how to check item in inventory.

Your value in stat page is capitalized. Code is stupid like that, it searches for lowercase “blessings”. You also should probably remove space between = and variable numbers.

1 Like

You’re almost there. Adding “” around the string, the text you want to show up, was a good start.
You just need to add another variable to startup.
One for checking if there is a blessing, *create blessing 0.
Then one that you can *set later to show text.
That would be *create blessing_text “”.

If you don’t write anything between the “” it won’t show any text.

Once you use *set in a scene, and write the text you want, it should work out.

2 Likes

OMG it so stupid how this actually work, it turn out i have to use all lower casing for blessing and use *set blessings 1 instead of *set blessings=1 for it to work. Also space between = and variable number doesnt matter. I guess i got confuse with the = with the if command and = doesn’t actually set the value for variable or something like that just a space would do normally.

@Sanadi
Also instead of just adding *create blessings 0 i need to add another line to to show text so in turn out like this in start up:
*create blessings 0
*create blessing_text “blessings”

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.