Odd bits of code


#1

So I was experimenting.
First I did this:

for dev purpose only, enter code (enter "bleh"):
*temp code
*input_text code
*if code != "bleh"
 *goto_scene {code}

And it worked fine for skipping to a scene, however when I enter [scene name] and [label] (ie. komorebi awake) I get the error: Couldn’t load scenes/komorebi awake.txt
The file is probably missing or empty. As if CS could only see the variable as a single word/input. I think that’s odd but makes some sense.

Next I did this:

for dev purpose only, enter code (enter "bleh"):
*temp code
*input_text code
*if code != "bleh"
 *{code}

Which does not work, period. It sees " *{code} " as text. So I suppose CS just isn’t wired for that.

If you have any thoughts or workarounds for these, please leave a reply. Thanks :wink::heart:

Unrelated note, but I feel guilty making so many topics: Does anyone know the ratio of CS sales on each platform, ie. 40% on google play, 10% on web, 10% on amazon fires/kindles, 40% on apple devices?


#2

CS can only work with filenames that are all one word. So a file called ‘komorebi awake’ wouldn’t work, it would need to be ‘koromebei_awake’


#3

Try using two separate variables:

*goto_scene {scene} {label}

#4

komorebi is the .txt file and awake is the label


#5

Yeah, that works. Thanks for your help.
and no idea if you can do something like this: ?

*{code}

#6

Wait, what?

So *goto {variable a} {variable b} actually works now? :eyes:

Hegh… hergh… hrngngngrrhghhh
Breathing difficulties


#7

@CJW What if you could use variables to let players create their own achiev… wait no, because achievements have to be made before any user input. Well it was fun idea for three seconds.


#8

Let the player make the game. I’m too lazy:

startup.txt

*create everything
*input_text everything
{everything}

#9

This is the best idea I have seen xD


#10

No, I’m afraid not :smile:


#11

I keep getting the error twiger_functions line 147: Non-existent variable ‘save_’

The code is:

*label save
*set save_{save_num} ""          <<<<< this is line 147
*set saveb_{save_num}b ""
*temp saves_string ""
*temp saves_char 2
*label save2
*if (saves_char > length(save_{save_num}))
 *return
*if (((save_{save_num})#saves_char) = "~")
 *set save_{save_num}b ((save_{save_num}b) & ("~" & {saves_string}))
 *set saves_string ""
*else
 *set saves_string (saves_string & ((save_{save_num})#saves_char))
 *set saves_char +1
 *goto save2

I’ve tried changing the line to all of these:
*set {save_{save_num}} “”
*set {(save_{save_num})} “”
*set (save_{save_num}) ""
The error stays the same for each of these. I know for a fact that save_num is 1 and there is a variable named save_1

EDIT: I fixed it by changing it to this:

*label save
*temp save_num2 save_num
*set save_num ("save_" & save_num)
*set {save_num} ""
*set save_num ("save_" & (save_num2 & "b"))
*set {save_num} ""
*temp saves_string ""
*temp saves_char 2
*label save2

#12

Perhaps that’ll work, but does it produce the result you wanted?
I mean, *set save_num ("save_" & save_num) will make the [save_num] variable went longer and longer. :thinking:

if for example, we already assign the value 1 into save_num beforehand.
This code

*set save_num ("save_" & save_num)

proceeded by the next code

*set save_num ("save_" & (save_num2 & "b"))

will transform the value of [save_num] first into “save_1

and the next transformation will change it into “save_save_num2b

Which is… not what you want, I guess.


IDK. Have you tried printing those variables?

BTW, I used similar concatenation mechanic as a subroutine to make a "list of collectibles you acquired."
So, yeah. Not really a saving system, but perhaps you’ll find something interesting.

Keep in mind that I have *created 3 variables: learnEngineer, log_Engineer

*label logEngineer
*set learnEngineer (("• "&log_Engineer)&"[n/]")&learnEngineer
*return

If at any point at the game I put a code like this:
*set log_Engineer "You got an Apple"
and run that subroutine, and put another “You got an Orange”, and run the subroutine again,

${learnEngineer} will result in
• You got an Orange
• You got an Apple

So, yeah. The text addition are not continous (the new text on the right side of the old text).


#13

Everything’s good now.