ChoiceScript Saving Plugin (Update: April 2023)

oop i see what i did wrong. Thank you so much!

No problem! Glad it worked out for you!

1 Like

RANDOMTEST FAILED: Error: startup line 87: Non-existent command ā€˜sm_initā€™
This error appeared when I ran the Random Test.

The demo works fine if I run it manually, Iā€™m just wondering if I did something wrong.

All I did was follow your instructions which was to add this
*sm_init mygame | 3 command right after my variable startup.

I think Randomtest and Quicktest canā€™t run any save system commands. You have to remove the commands or comment them out to run automated testing.

Thanks for that, Iā€™ve been pulling my hair. Trying to get everything to work.

You can put it in an *if clause, too:

*if not(choice_randomtest)
    *sm_init gamename | 3

I donā€™t know if thereā€™s an equivalent for Quicktest (like choice_quicktest); I never really used Quicktest while I was developing my gameā€¦ :thinking:

Just as an aside, I would recommend not using mygame as your game name, or itā€™ll clash with any other game that uses that; itā€™s best to stick to something unique.

Iā€™ll try that

The quicktest doesnā€™t bother me that much. It keeps sending me errors about my subroutines. Though when played manually, the demo works fine.

I actually did it. All hail @CJW and @Malebranche, thanks for the help guys

1 Like

Still works?

Should do.

Links and imagens are broken here! Can you help me?
Sorry, Iā€™m new here, just building my first game!!
image

Press chain icon to hyperlink. You can also drag and drop the image into reply box.

The big problem is that there is no save.js to download!
I think this is the file there!

You donā€™t need save.js. Download from this thread smPlugin.js and smPluginMenuAddon.js. Put both in choicescript\web folder. Then with notepad add following lines to the choicescript\web\mygame\index.html

<script src="../smPlugin.js"></script>
<script src="../smPluginMenuAddon.js"></script>

Put these 2 lines between scene.js and navigator.js. Add *sm_init mygame | 5 to the startup.txt, after all of your declared variables. Should work after that.

4 Likes

@anon8836198 worked! Thank you very much!
@CJW thank you! It helped a lot!

2 Likes

Thank you for helping @Yamanokami out @anon8836198. I admit the thread structure is a bit dated and messy, Iā€™ll see about tidying it up.
Glad the plugin is still helping people!

2 Likes

Hello, Iā€™m new to ChoiceScript and when I heard that you can add a save feature I was so excited. But apparently it was a bit confusing on learning on how to use it and what to add. I had to read all the comments, from first to the very latest (456 comments were there I think), until after so many hours of reading and rereading and typing, it finally works! Thanks @CJW! (I just felt like I really needed to say thanks, as Iā€™m full of happiness for finally getting it :sweat_smile: Also I hope my message isnā€™t a burden so please ignore if itā€™s badā€¦)

2 Likes

Hi,

Iā€™m just implementing the plugin. Running my game and loading I receive error message:

invalid line; this line should have a scene name followed by an error message

I can see this crops up in WIP beta feedback, but havenā€™t yet found what the solution is (or whatā€™s causing it). Anyone able to help?

Thanks.

Full message:

Error: chapter_01_the_carpenter__ria line 143: invalid line; this line should have a scene name followed by an error message: *if ((reread = false) or ((c_m_z#jump_to_page_minus_one) = 0))

This is interchangeableā€“the message will appear referring to a different line number if Iā€™m loading from a later page. It always refers to a choice on that page. Eg:

Error: chapter_01_the_carpenter__ria line 196: invalid line; this line should have a scene name followed by an error message: *if ((reread = false) or ((c_m_z#jump_to_page_minus_one) = 0))

The referenced code looks like this:

*fake_choice
	*if ((reread = false) or ((c_m_z#jump_to_page_minus_one) = 0)) 
		#Turn the page.
			*if reread = false
				*set c_m 0
	*if not (((choice_randomtest) or (reread)) or (skip_forward))
		#Menu.
			*gosub_scene operation_menu
	*if (reread)
		#Return to page ${p}.
			*goto_scene operation_reread_skip_forward return_to_page_choice
  • Issue replicated on firefox (using index.html) and through dashingdon.
  • Did this
  • Did this:
  • Did this

This usually happens if you try to load a save from an old file. That is, loading a save after you made changes to your game.

1 Like

Thanks so much for the reply.

I have double-checked, but:

  • having deleted the save,
  • then saved a new save
  • then loaded that save

I still get that error message, despite no changes having been made to txt files, (and no progress in game)