New author completely lost with the coding system

Hi everyone,

I’ve downloaded what seemed necessary to write and use the coding system, read the basic guide, and tried to write some lines by myself. Honestly, I’m completely lost. I’ve done and studied a lot of stuff in my life, but coding isn’t one of them. I really start from scratch and even after a few hours of reading, I can’t see if what I have written works or not.

How can I see if a page I have coded is correctly written and works? I suppose the program should show it like a CoG page or something like this? Basically, how can I test if what I’m doing is correct?

Please remember that I have 0 coding experience.

Thank you in advance.

1 Like

Here’s the website I use. It lets you test your game, and if there’s an error it will show you where. It saves you coding for you, and you can download the file whenever you want. The only problem is that it only lets you create one game per web browser. Though I think there’s a desktop version you can download, but I couldn’t figure it out.

https://choicescriptide.github.io/legacy/ide/main.html#

1 Like

If you aren’t already, I HIGHLY recommend using CSide. It makes learning Choicescript much easier and you can test your code right in the engine. Until you get a better handle on it you can literally write a line of code and run the game to see if it works and change it immediately if it crashes your game. I’m not a coding genius at all, but CSide made it easy to pick up the basics to make a functional game.

13 Likes

I’ve also found as a newbie coder it’s best to only look up what you need as you need it. While that can limit the scope of what you can do with Choicescript, a limited scope is actually a great thing to have when you are first starting out. You can make a perfectly good game with just variables and comparing them.

As you get more confident and want to do more complicated things (like multi replace and gosubs) google how to do things you want to do, I can almost guarantee there has already been someone who asked the same question on the forum. If not, then ask the question yourself, the forum goers are quite happy to help out with answering questions.

6 Likes

If you use Visual Studio, there is a button at the bottom of the screen that says “Open in Browser.” It lets you see how it looks on the page.

I also rec copy/pasting this text and dropping it into CSide or VBS: https://www.choiceofgames.com/dragon/scenes/queenpolitics.txt

You’ll be able to see how the code is highlighted/etc then. It’s a good example of actual, working code.

But, beyond that, what about coding is tripping you up?

Personally, I’ve made myself a cheat sheet in my notebook that I reference when I forget something.

I second pretty much everything Lance said in both posts.

2 Likes

Thanks all of you for the advices. I should have kept things a bit more simple, but my story has too many complicated choices with gosubs and multis. I honestly underestimated the complexity of the process for a newb in coding. But I will proceed with tests and fails. I would rather take my time and keep the story as I like it than remove the deep choices and the implications of those.

I will try using Choicescript IDE and CSide with some simple vignettes and see if what I wrote works.

4 Likes

You probably don’t need these as much as you might think you do. I wrote my whole first game, which was both long and complex, without using either. If you’re having trouble understanding them, then I’d recommend thinking about ways to achieve the same depth of choice using code features that you understand better. Ultimately, the more complex features are shortcuts to doing things you can almost always do with only slightly clunkier but equally effective code.

CS is fundamentally a language for beginners and non-coders, and no author should feel that they’ve got to master its “advanced” features before they can write an awesome game. The sophistication of the coding is a different thing to the sophistication of the game.

4 Likes

I hope so,

For now I’m finishing the writing part of the first chapter, with a lot of vignettes. Then I will fully try to code it and see how it goes.

Thanks for the advices.

good choice, CSIDE highlights syntax errors, which can help you quickly identify mistakes in your code. Take advantage of the auto-complete feature which suggests commands as you type, reducing typos and learning the syntax faster.

Here’s a simple example vignette you might start with:

*title My First Vignette
*scene_list
  startup
  
*create leadership 10

*label start
You are the leader of a small tribe in the ancient world. What is your first command?
*choice
  #Organize a feast to boost morale.
    *set leadership %+10
    Morale boosts as your tribe enjoys the feast. Your leadership skill increases.
    *goto start
  #Train your warriors.
    *set leadership %+5
    Your warriors improve their skills, and respect for you grows.
    *goto start
  #Explore nearby lands.
    You find valuable resources, but also potential dangers.
    *goto start
  #Conclude the scene.
    *finish

To see if your page is correctly written and functioning, you should follow the steps to run the ChoiceScript server as mentioned above. Once it’s up, you can navigate through the game development or scene you have coded directly in your browser. This will show you how your choices play out and if the text and commands are functioning as intended.

A practical tip is to start with very small code segments, test them, and then gradually add more complexity. This way, you can identify where errors might be happening as you go. Also, keep an eye on indentation and syntax—ChoiceScript is particular about these, and small mistakes can cause your code not to run as expected.