Official codes in COG software

I use the COG software and forum.choiceofgames.com to make my game. I also see other people talk about different *codes that aren’t in the forum’s list. Is there a complete list of codes that I can use?

There’s a ChoiceScript Wiki that might prove useful:

But if you need any help with ChoiceScript, then just post a question to #game-development:choicescript-help so the community can try and help you.

I was referring to that wiki. I just happen to see others post about other codes not listed on the wiki. Thanks for the other forum group.

For certain reasons, I will continue to ask my questions here. I know about this link: https://choicescriptdev.fandom.com/wiki/Index however, I am wondering what codes are available that are not listed on here. In addition, some of the codes don’t have any information attached to them, so any elaboration would be helpful. By the way, Merry Christmas everyone!!!

This, perhaps can best be addressed by @dfabulich .

Unfortunately, many of us are not as knowledgeable as others.

1 Like

Here’s your best source for a complete list of valid commands: https://github.com/dfabulich/choicescript/blob/e9e8e65d834525b20470817052e22fef5e5029cf/web/scene.js#L4392

Sadly there are no descriptions, but if they’re not also listed on the wiki, then they’re probably not hugely relevant to the average CS Dev (e.g. *restore_purchases, *check_registration).

3 Likes

Thank you very much! This seems very authoritative! I have sent an email to Dan too, so between him and this link, I think that will be my best. I know the only other thing is that the *script command allows me to bring in Java coding, since choicescript is based on Java, but since I am not fluent in Java, at this time, I don’t plan on learning it too quickly. Though, with what I am planning on coding in my IF game, I am looking for some ways to make my coding efficient. I will say, I wish there were the two following codes: *gotoref_scene and gosubref_scene. I have a workaround for now, but if only that code existed.

Gotoref is a predecated command (and all the *setref “reference” based commands). I personally haven’t been around the time these were used, but I think *goto_scene and *gosub_scene should serve the same purpose.

I use all those commands, yet they still don’t do what I wish *gotoref_scene and *gosubref_scene would do for me. I’ll explain.

Let’s say a reader “Johnny” wants to transport their character “Sally the Wizard” to one of the five major transport circles using the magic wand of transport. Now, if my game has each of those five transport circles located in five separate scenes {city_1, city_2, city_3, city_4, and city_5}, I presently have to do the following commands or something similar to this:

(note: the spacing is not shown correctly when I submit, so just assume my spacing is correct)

Where does {character_name} the {character_class} want to go using the Magic Wand of Transport?
*choice
#City 1
*goto city_1
#City 2
*goto city_2
#City 3
*goto city_3
#City 4
*goto city_4
#City 5
*goto city_5

*label city_1
*goto_scene city_1 (or *gosub_scene city_1)

*label city_2
*goto_scene city_2

*label city_3
*goto_scene city_3

*label city_4
*goto_scene city_4

*label city_5
*goto_scene city_5

Now, if I happened to have *gotoref_scene, I could do this:
*temp destination “”
*implicit_control_flow True

*choice
#City 1
*set destination city_1
#City 2
*set destination city_2
#City 3
*set destination city_3
#City 4
*set destination city_4
#City 5
*set destination city_5

*gotoref_scene destination (or *gosubref_scene destination)

I turned 10 lines of code down into two lines:

  1. *create (or *temp) destination “”
  2. *gotoref_scene destination
    (technically 3, but I use “*create implicit_control_flow True” anyway, but it is still another line. Also, the *create destination “” only needs to be done once as well in the startup scene, so over the entire project, I would say that the ten lines are replaced by one line.

In the end, it would save a lot of lines of code.

Does this make sense?

*goto_scene {myvar}
*gosub_scene {myvar}

The “curly brace” syntax replaces the deprecated “ref” commands.

3 Likes

So use {} instead of ()?

OMG! YAY! I am so glad to know about that now!!! You are a life/time saver!!!

2 Likes

So, I have another question. I know that if someone presses restart at the top of the screen, everything but the *achievements are erased. Is there a way to disable that button?

Currently, no. Nothing officially supported, at least. However, if you’re proficient with JS, you can tweak the file ui.js and probably //comment out the restart-button code.

What software do I use to open up the ui.js file to edit it? Using the // command is easy enough. It is just like *comment, but just much shorter.

Any text editor would do it. The one you use to write your game’s code should be enough.

Should this do it?

//
// var restartButton = document.getElementById(“restartButton”);
// restartButton.onclick = undefined;
// restartButton.addEventListener(“click”, function() {
// restartGame(“prompt”);
// }, false);

Try it out yourself. I’m currently unable to do the coding myself right now, so you have to see it for yourself.

Sounds good. I’ll let you know how it goes.

Another question at the moment: What other commands are also predicated from that list in the index or in the link that was provided above besides the ref commands being replaced with {}?

Since we are coming up on a New Year, I want to make sure everyone who has been helping me in this post gets great fortune! So @rose-court, @Eiwynn, @CJW, and @Szaal, I want to let you know that you will get great fortune in the next decade, the 2020s as verified by @discobot fortune

Edit: He is supposed to give a fortune! :confused:

2 Likes