[CSIDE] The ChoiceScript IDE

I really like this idea a lot! For one thing, I find it easy to forget which project I’m working in if I have two similar-but-not-same versions of the same project running simultaneously, to test a certain section or not break my working version or such.

I would especially like this if the prompts would switch automatically to whatever project one last ran (or at least, if that could be an optional setting): so in opening, you’d be @global, and then on hitting the run button Project One you’d have @Project_One unless you manually switched back to @global or @Project_Seventy-three or what have you.

Regarding the console in general: I feel I should mention in general that I was once (years ago once, back in CSIDE beta) quite opposed to the Console, and certain aspects of it, because I came into ChoiceScript very green at coding and not terribly confident. I thought it was going to be a required tool for a bit and was very alarmed.

Then I relaxed cos I found out it isn’t required. Then I asked about a way to more easily navigate the code whilst playing through…Thanks to the help instructions and some fiddling around and questions, I fell in love with the Console. Being able to use it to jump to any scene or label whilst playing a game for beta testing, or set variables so I could try the same scene six times with different stats without having to restart or play through…all very helpful. Plus there’s using it for calculator functions, or using it to test code that’s not integrated into the game yet.

To expand on this a bit, if that’s all right:

When I’m tinkering around with the Console, one of my favourite functions is actually changing variable values. That’s basically using Console like a calculator. The commands in Console would look like this, much like in actual ChoiceScript:

*set var 50
*set var %+20

That would set your variable to an assigned value, and then alter that value.

Then, to get Console to tell you the new value of the variable, you would type in:

var

and the Console very helpfully replies

60

(or whatever the appropriate value is in your particular instance.)

So maybe what would be better is a clearer explanation of ‘How to Use the Console as a Fairmath Calculator’ in the helps documents? (Also @CJW, would it be possible, or smart, to add screenshots to the helps documents? That would make those kinds of explanations much easier. Also also, maybe this should be the topic of that article I promised to write about how CSIDE helps me be a better writer/coder…)


Whatever ends up happening with a ChoiceScript calculator within CSIDE, and I can see that there are loads of neat possibilities, I would love to still see a prefix function in the Console. It’d be really useful to have a global console (and maybe it could clear by either closing CSIDE or with the *clear command? seems logical). I don’t think it’d be confusing as long as the Console clearly marks which project, or the global, that’s being tinkered with. And I’d love to be able to tinker with two projects at once.

Edit: I made a little screenshot version of using the Console as a calculator, in case that’s useful to anyone. I used a *temp variable I’d created in the scene file, but I could have also created a `*temp’ variable with Console if I didn’t want to change any of my game variable values. Here it is:

Console Calculator

Viewing the variable’s value in console:

Changing the variable’s value:

End result, also visible in the running game:

1 Like

I’ve been playing around with how to allow customisable syntax highlight for a while now, and haven’t come up with anything I’m overly happy with. It’s a tough one to get right in terms of balancing the ease of implementation, the UI/UX and flexibility of the system.

  • Editing themes directly and importing would be inaccessible to a lot of users
  • A GUI would limit flexibility or massively impact the app’s UX

Etc.


What I came up with today was something of a middle ground, which is to basically allow you to specify themes in a CS format, like so:

I’m looking for feedback on this, as it is quite a weird way of doing things, and whilst I’m not 100% happy with it - it’s the tidiest way I’ve come up with so far. Just bear in mind this is super right off my laptop, made in the last hour alpha development material - it is not final or feature complete. I’m just looking for general/broad feedback on how this might work / be acceptable (or not) to you before I commit any more hours to it.


It’s worth clarifying that you would run this once, and it’ll store your “custom” settings as a “custom” theme in the settings panel. You wouldn’t have to include this code in your actual projects (though, you could… If you fancied different themes for different projects, nice little side effect).

3 Likes

Thank you for blessing such an amazing IDE on this community. From the moment I opened it, I’ve fell in love with it. Just the thing I needed. The community thanks you.

It’s still not perfect, though, and I’ll be helping you remove the bugs that inevitably creep in. I don’t have any suggestions honestly, it’s pretty awesome already.

Okay so the first bug I found is that when the IDE detected that there’s mixed indentation (spaces and tabs) and I chose to auto fix it, it actually removed all indentation from all choice commands! Could you please look into that issue?

Anyway, that’s just a minor inconvenience at best, and I’m sure I’ll keep on bugging (lol) you with a lot of feedback. Thank you once again for this lovely piece of software.

2 Likes

That would be very much appreciated, thank you! For the indentation issue, would you mind PMing me a link to the file that this occurred in (before it did, if you have a copy)? Were you using the default indentation settings, or had you changed them?

I actually like it! Especially since we can use hexacode for the color.

Just a question, tho. Are those *cside should be included on the actual startup.txt?

I mean, of course we can remove those lines if we’re about to publish the work, but I guess just for clarification.

2 Likes

My plan is to include an example project that you can edit under the templates tab. You’d clone it, edit it, run it and then your custom theme will persist until you edit and run those commands again. You can do it within your projects, but it’s not the intended behaviour. :slight_smile:

The names and syntax also aren’t final. I’ll probably try and make it less verbose. Thank you very much for your feedback!

2 Likes

Code Folding Preference

Code folding is ready to go in the next update, I was just wondering if any users had a preference for how a folded block of code is denoted?

  • Double arrow:
  • Ellipsis: […]
  • Other (please comment!)

0 voters

Supporting images


2.

3.

1 Like

Custom syntax highlighting and code folding are almost here?!! :smile:

On the highlighting, it looks terrific, but I think is still missing an aspect I liked in Atom – having a line change color when you complete a command or close quotes… I know, everyone has their personal favorite syntax!

Summary

Atom
A *set or *create command is white until a value is entered, and the line turns three colors, making it easy to see what variable is changing how, and whether I’ve finished typing the line. Other commands are blue, but the rest of the line is white, once again helpful for remembering what’s going on at a glance.

Ordinary text is white until a quote is closed, then turns green. Doesn’t do this with parentheses, but it does have all parentheses bright orange. Helps me remember to close things and keep track of dialog/description.

2 Likes

Sorry if this is not the best place to ask but does CSIDE have a way to find/calculate possible mins, maxs, and frequencies of a stat? For example, a morality stat, starting at 50 and only changing via fairmath, can go as low as 22 and as high as 98? And ending stats grouped by 10s like:
91-100: 2
81-90: 12
71-80: 40
etc…

Here’s a reference
http://www.sibylmoon.com/debugging-choicescript/#statblocks

5 Likes

Hey I posted a reply on this!
Goddamn Wi-Fi on planes.
Okay I guess I’ll cut the joke answer,

I vote for the ol’ [ + ] and [ - ] synbols, and if that gets no support, then the simple double arrow.

1 Like

Excited about the updates! They’re going to be super useful; I’m especially looking forward to code folding for long scenes.

As to the visual aspect: I vote against the ellipsis, only because there are other visible ellipses in my code (and other people’s code which I edit), so something distinct from symbols that might already be visible would be vastly preferable. Much easier to visually scan for.

Style sheets, will it also be possible to bold or italicise the fonts? I would find that very helpful. I do love that it can be different between projects, too; that would be quite useful as well.

I really like @Alexandra’s suggestion of allowing for line colour change when a command or quotes are completed too. Right now I type in a manual key to remind myself to go back and finish trailing bits, but having it colour-coded would be brilliant.

3 Likes

This is certainly something I’ve occasionally wished for in my writing… I have no idea how easy it would be to code, though. (Maybe as output from RandomTest? :thinking:)

Not at all! This is the perfect place for any questions related to CSIDE! To answer yours: it ships with random test, so I don’t see any reason you couldn’t continue to use the mentioned method.

As for something more specific or tailored… Not at present. You can certainly use the console (and associated commands) for some extra logging and analysis, though how exactly how that might be of help I’m not sure.

Is there a particular implementation you’re looking for? Some way to improve over what you linked?

Perhaps we could modify CSIDE’s randomtest? Or a seperate tool that does the analysis on its output. What I wouldn’t want to do is write what is essentially a new random test that serves only that one purpose. Definitely open to discuss this at any rate as it seems a popular request :slight_smile:


@Alexandra

We have a small amount of this, in that I think we require a space to colour, but it could certainly be improved and better tailored to individual commands. It would be nice if we could quote strings but only when on commands lines. I’ll probably make a github issue outlining a plan for these changes, good suggestions, thanks!


@Fiogan good point!

And yes, bold/italics are very doable. What I’ve shown is just initial idea dump. The nice thing about doing it as a script is that functionality is easy to add and change - not so much when it’s depending on a UI.

1 Like

I’m just excited at the possibility of @JimD working on another big project.

Edit:
I did run into an error when trying to do a simple fairmath test.

Screenshot

My code:

*create stat01 0

*label main
Fairmath Test.

*set stat01 (stat01 -100)
stat01 = ${stat01}

Now we will try and subtract using fairmath.
*page_break

*set stat01 %-20
stat01 = ${stat01}

*page_break
*goto main

Edit 2:
This also generates an error if the number (of the stat) is above 100.
However, it does work if the number is 0, because it rounds it to 1.
So… any automated testing of fairmath would need to make sure the stat is within a valid range first.

The problem is with my game size and games like yours -they are too big to run 10,000 outputs and show text. It breaks my browser.

If CSIDE could output the Nth iteration of randomtest, it would work. Basically, running 1000 or more outputs lags my browser to hang. All I need to see is the frequency after the last iteration… but it hangs before I get there. I would be happy to discuss it further as this is a major help that a lot of game writers would use if they knew it was available.

5 Likes

Hello everyone, sadly, I had a strange and serious problem with this IDE that caused me to put it aside for now.

First i was making the game with Notepad++, eventually i decided to try out the IDE. However at work i cannot install it, so i used the IDE at home and Notepad++ at work.

IDE started saying the files had mixed spaces and tabs, so i allowed it to fix. But then i noticed it was not adding tabs properly, like it was doing this:

*choice
  #Choice1
  this is what happens when 1 is chosen
  #Choice2
  this is what happens when 2 is chosen

instead of

*choice
  #Choice1
    this is what happens when 1 is chosen
  #Choice2
    this is what happens when 2 is chosen

It didn’t indent things properly, and i thought this was just the way the program worked, so i right clicked the projects and asked it to change all spaces to tabs, and it remained as it was. I thought it was indented properly but that the IDE just showed like that to make it easier or something.

Well, turns out it didn’t, now i can’t fix it and i have to fix it all by hand. I don’t know if this happened because i was switching with Notepad++ or not, but it’s weird and it’s a lot of manual work to fix them now. Luckily i have some backups before i did it, so i can copy and paste the bigger code sections.


Other things i suggest, which are mostly Notepad++ features that are handy and i missed them when using the IDE:

  1. Hotkey to comment line.
  2. Hotkey to duplicate line.
  3. Hotkey to erase line.
  4. Make the spell check disable for things like variables after *create, *set, *label, *goto and such.
  5. I know the CTRL+Z and CTRL+Y hotkeys work, but an Undo and Redo button would still be useful, if only so that the user know that a change has been performed.
  6. The “insert double line break” function does not insert into indentation corretly. Making you have to fix the indentation of the line breaks if you are inside a *choice or *if.
  7. Split view for two different files or the same file.
  8. When you search for something, pressing enter repeatedly should jump into the next occurence of the result. The way it is now is that if you press enter repeatedly it will overwrite the result (because the result comes selected once found).
  9. If you select a word, it could highlight the same word if it appears in other locations of the file, making it easier to find *gotos and *labels. Like this:


On the positive side, i like that it tests the game right in the IDE itself, and shows errors much better than the browser, i will certainly test the game on it. The CTRL+B and CTRL+I hotkeys are handy as well.

3 Likes

@GoldenSilver and @JimD: If it’s all right, I’m going to put up these feature requests and @GoldenSilver’s bug report on CSIDE’s Github page to make the work flow a little easier and make sure none of the requests get misplaced or overlooked. And thanks!


Edit: @GoldenSilver, your requests are up, numbers 18 through 24 on the page I linked.

@JimD So is your query/suggestion about ways to calculate frequency and min/max of stats, issue no. 25 on the same page.


Split view has been mentioned before a few times; @CJW, is that in the works, or is it something that should go up on Github too?

If these two suggestions are implemented, would that possibly be something that could be toggled off/on in settings? I get distracted easily, so having highlights all over my page if I select a word would confuse me. And I use spellcheck plus the user dictionary for my variables to make sure I keep them straight.

Right now, using Find does highlight all instances of a word, so that’s one way to get similar functionality via a slightly different method.

Pressing CTRL/CMD+G will bring you to the next instance of the word.

Personally, I like having the Find result selected because I can use CMD+G to jump to an instance, manually make whatever changes I want to make, and then hit CMD+G again to go to the next instance without having to do any mouse dragging, clicking, etc. It took me a bit to get used to at first (I was used to Enter also) but now I find it helps me speed up editing a good bit.

2 Likes

At least in notepad++ that stuff i suggested is all able to be toggled on and off in the settings screen. I think it should be simple to have the same here.

That’s cool, i hadn’t noticed. But it’s very helpful in notepad++ to just double click a word in a big area of code and be able to see variables and stuff near.

I hadn’t noticed as well, i haven’t checked the hotkeys for IDE so some of the stuff i suggested might already be in actually.

I saw that you put it all in github, let me know if you need the bugged files and fixed files for the indentation bug or other stuff that is needed to check the bug, i can provide.


New suggestion, not sure if already in the IDE:

Have a button or hotkey to jump to the next flagged instance by the spellcheck.

1 Like

Incredibly dumb question here. I mean, just utterly stupid. I’ve clearly missed something obvious, but there’s nothing to make you recognize the obvious like posting publicly about it :slight_smile:

So: Do I need to download the dictionary or something?

The first paragraph of my story looks like this: https://i.imgur.com/erKTAHX.png

As you can see, I’m getting spelling errors in some interesting places. I mean, obviously there’s some kind of actual dictionary there under the hood for it to recognize words like ‘year’ and ‘tour’, but just as obviously something is very wrong because ‘the’ is not exactly an obscure word and yet it’s not there.

I can build up the dictionary manually, but I figured for something this off there might be a simpler solution that I’ve overlooked.

Thanks :slight_smile:

That’s…really strange. The dictionaries come packaged, and you can choose UK or US, but other than that they really should behave like typical digital dictionaries, and include ‘the’ and other such words.

What version of CSIDE and what OS are you using?

Edit: I put the issue up on Github here for @CJW, too; it’s issue 26.

1 Like