A Thank You, Functions and Copyright

Hello everyone,

My name is Steve, I’m a pretty fresh face here with CoG. I recently discovered this fantastic library after stumbling across the Way Walker series on the iTunes app which, naturally, lead my curiosity to the website. Upon discovering Choicescript, I have been dabbling at creating my own work as interactive storytelling is every bit of a dream I’ve wanted to achieve; I wish I would’ve found it sooner. Which comes to my thanks, truly. There are periods in a person’s life where they can’t seem to figure out which path they should pick or which they should return to and it’s a definite bummer, to say the least. I’ve found myself in a very complicated period in my life as such. Choicescript has revived inspiration in me that I was afraid was lost and, for that, I am grateful.


Functions

There was something I have thought about while writing and, perhaps it’s due to the lack of experience, I’ve found that building and math sequences around my story can become cluttered depending on how many variables are involved. I understand the limitations as well as the simplicity of Choicescript which, surprisingly, has been very refreshing; but I may have a suggestion that could potentially “clean up” this problem: functions.

Below are three math functions that I planned to use frequently throughout my story. As you can probably tell, depending on the frequency, this can create huge blocks of math that can clutter organization; plus trying to relocate the actual sequence to copy and paste:

/**Average*/
*set power round((((((((str)+(dex))+(int))+(wis))+(cha))+(per))) / 6)

/**Lowest Stat*/
*if (((((str<=dex) and (str<=int)) and (str<=wis)) and (str<=cha)) and (str<=per))
	*set warrior true
*if (((((dex<=str) and (dex<=int)) and (dex<=wis)) and (dex<=cha)) and (dex<=per))
	*set rogue true
*if (((((int<=str) and (int<=dex)) and (int<=wis)) and (int<=cha)) and (int<=per))
	*set mage true
*if (((((wis<=str) and (wis<=dex)) and (wis<=int)) and (int<=cha)) and (int<=per))
	*set cleric true
*if (((((cha<=str) and (cha<=dex)) and (cha<=int)) and (cha<=wis)) and (cha<=per))
	*set bard true
*if (((((per<=str) and (per<=dex)) and (per<=int)) and (per<=wis)) and (per<=cha))
	*set gambit true

/**List*/
*if (warrior)
	*set weakest &"warrior"
	*set comma true
*if (rogue)
	*if (warrior) and ((((not (mage)) and (not (cleric))) and (not (bard))) and (not (gambit)))
		*set weakest &" and rogue"
		*set check true
	*if (not (check))
		*if (comma)
			*set weakest &", "
		*set weakest &"rogue"
		*set comma true
*if (mage)
	*if ((warrior) or (rogue)) and (((not (cleric)) and (not (bard))) and (not (gambit)))
		*set weakest &" and mage"
		*set check true
	*if (not (check))
		*if (comma)
			*set weakest &", "
		*set weakest &"mage"
		*set comma true
*if (cleric)
	*if (((warrior) or (rogue)) or (mage)) and ((not (bard)) and (not (gambit)))
		*set weakest &" and cleric"
		*set check true
	*if (not (check))
		*if (comma)
			*set weakest &", "
		*set weakest &"cleric"
		*set comma true
*if (bard)
	*if ((((warrior) or (rogue)) or (mage)) or (cleric)) and (not (gambit))
		*set weakest &" and bard"
		*set check true
	*if (not (check))
		*if (comma)
			*set weakest &", "
		*set weakest &"bard"
		*set comma true
*if (gambit)
	*if (((((warrior) or (rogue)) or (mage)) or (cleric)) or (bard))
		*set weakest &" and gambit"
		*set check true
	*if (not (check))
		*if (comma)
			*set weakest &", "
		*set weakest &"gambit"
		*set comma true

The idea of the functions is simple: build “wrappers” for these types of algorithms. It’s as easy as mapping these guys once and using a simple call on them, like a “packaging” tool. On top of this, if your variables change, you don’t have to go back and input different variables on a whole new instance. I believe I have a very simple format that correlates with Choicescript’s logic and wouldn’t be too intimidating to users. Let’s use those three, previous algorithms as examples:

Basic Wrappers

Basic wrappers are one-time calls with (all functions I’m talking about implementing are simple void statements, for those familiar with Java) concrete variables that you don’t plan to change the name of. For my example I’m using strength, dexterity, intelligence, wisdom, charisma and perception as variables that will stay the same regarding these functions, we’re just setting their values to something new as we call it.

/**Average*/
*func avg
	*set power round((((((((str)+(dex))+(int))+(wis))+(cha))+(per))) / 6)

//call this function
*avg

/**Lowest Stat*/
*func lowest_stat
	*if (((((str<=dex) and (str<=int)) and (str<=wis)) and (str<=cha)) and (str<=per))
		*set warrior true
	*if (((((dex<=str) and (dex<=int)) and (dex<=wis)) and (dex<=cha)) and (dex<=per))
		*set rogue true
	*if (((((int<=str) and (int<=dex)) and (int<=wis)) and (int<=cha)) and (int<=per))
		*set mage true
	*if (((((wis<=str) and (wis<=dex)) and (wis<=int)) and (int<=cha)) and (int<=per))
		*set cleric true
	*if (((((cha<=str) and (cha<=dex)) and (cha<=int)) and (cha<=wis)) and (cha<=per))
		*set bard true
	*if (((((per<=str) and (per<=dex)) and (per<=int)) and (per<=wis)) and (per<=cha))
		*set gambit true

//call this function
*lowest_stat

/**List*/
*func weakest_list
	*if (warrior)
		*set weakest &"warrior"
		*set comma true
	*if (rogue)
		*if (warrior) and ((((not (mage)) and (not (cleric))) and (not (bard))) and (not (gambit)))
			*set weakest &" and rogue"
			*set check true
		*if (not (check))
			*if (comma)
				*set weakest &", "
			*set weakest &"rogue"
			*set comma true
	*if (mage)
		*if ((warrior) or (rogue)) and (((not (cleric)) and (not (bard))) and (not (gambit)))
			*set weakest &" and mage"
			*set check true
		*if (not (check))
			*if (comma)
				*set weakest &", "
			*set weakest &"mage"
			*set comma true
	*if (cleric)
		*if (((warrior) or (rogue)) or (mage)) and ((not (bard)) and (not (gambit)))
			*set weakest &" and cleric"
			*set check true
		*if (not (check))
			*if (comma)
				*set weakest &", "
			*set weakest &"cleric"
			*set comma true
	*if (bard)
		*if ((((warrior) or (rogue)) or (mage)) or (cleric)) and (not (gambit))
			*set weakest &" and bard"
			*set check true
		*if (not (check))
			*if (comma)
				*set weakest &", "
			*set weakest &"bard"
			*set comma true
	*if (gambit)
		*if (((((warrior) or (rogue)) or (mage)) or (cleric)) or (bard))
			*set weakest &" and gambit"
			*set check true
		*if (not (check))
			*if (comma)
				*set weakest &", "
			*set weakest &"gambit"
			*set comma true

//call this function
*weakest_list

With variables

Using variables is actually a pretty simple concept for Choicescript. All variables are, when attached to a function, is elements to use inside of that particular function. This can range from the local variables you want to use to even having a string (which I’m using for the list example). The benefit of this system is that you can change all your variables throughout your story while holding onto the core methods you built previously. The only downfall I see from this is the number of variables you’re using as you will be tied to whatever original number of variables you built for that function.

/**Average*/
*func avg n1 n2 n3 n4 n5 n6 x1
	*set x1 round((((((((n1)+(n2))+(n3))+(n4))+(n5))+(n6))) / 6)		

//call this function
*avg str dex int wis cha per power

/**Lowest Stat*/
*func lowest_stat n1 n2 n3 n4 n5 n6 x1 x2 x3 x4 x5 x6
	*if (((((n1<=n2) and (n1<=n3)) and (n1<=n4)) and (n1<=n5)) and (n1<=n6))
		*set x1 true
	*if (((((n2<=n1) and (n2<=n3)) and (n2<=n4)) and (n2<=n5)) and (n2<=n6))
		*set x2 true
	*if (((((n3<=n1) and (n3<=n2)) and (n3<=n4)) and (n3<=n5)) and (n3<=n6))
		*set x3 true
	*ifif (((((n4<=n1) and (n4<=n2)) and (n4<=n3)) and (n4<=n5)) and (n4<=n6))
		*set x4 true
	*if if (((((n5<=n1) and (n5<=n2)) and (n5<=n3)) and (n5<=n4)) and (n5<=n6))
		*set x5 true
	*if if (((((n6<=n1) and (n6<=n2)) and (n6<=n3)) and (n6<=n4)) and (n6<=n5))
		*set x6 true

//call this function
*lowest_stat str dex int wis cha per warrior rogue mage cleric bard gambit

/**List*/
*func weakest_list n1 n2 n3 n4 n5 n6 x1 x2 x3 x4 x5 x6
	*temp check false //notice a variable is created specifically for the function instead of having it outside, more for organizational purposes.
	*if (n1)
		*set weakest &x1
		*set comma true
	*if (n2)
		*if (n1) and ((((not (n3)) and (not (n4))) and (not (n5))) and (not (n6)))
			*set weakest &" and "&x2
			*set check true
		*if (not (check))
			*if (comma)
				*set weakest &", "
			*set weakest &x2
			*set comma true
	*if (n3)
		*if ((n1) or (n2)) and (((not (n4)) and (not (n5))) and (not (n6t)))
			*set weakest &" and "&x3
			*set check true
		*if (not (check))
			*if (comma)
				*set weakest &", "
			*set weakest &x3
			*set comma true
	*if (n4)
		*if (((n1) or (n2)) or (n3)) and ((not (n5)) and (not (n6)))
			*set weakest &" and "&x4
			*set check true
		*if (not (check))
			*if (comma)
				*set weakest &", "
			*set weakest &x4
			*set comma true
	*if (n5)
		*if ((((n1) or (n2)) or (n3)) or (n4)) and (not (n6))
			*set weakest &" and "&x5
			*set check true
		*if (not (check))
			*if (comma)
				*set weakest &", "
			*set weakest &x5
			*set comma true
	*if (n6)
		*if (((((n1) or (n2)) or (n3)) or (n4)) or (n5))
			*set weakest &" and "x6
			*set check true
		*if (not (check))
			*if (comma)
				*set weakest &", "
			*set weakest &x6
			*set comma true

//call this function
*weakest_list str dex int wis cha per "warrior" "mage" "rogue" "cleric" "bard" "gambit"

Again, really the purpose of introducing functions to Choicescript is mostly for organizational and time-management purposes. I believe this can save people a good chunk of time trying to sift through equations they’ve built previously and having to copy and paste them while also consolidating a lot of lines in text.


Copyright

I am fairly new to storytelling and brand new to the idea of publishing said works. I had a quick question regarding copyright and references other works within your story. Is there copyright to be followed when referencing these works? For example “Josh listened to Linkin Park all the time when he was younger.” or “Bridge to Terebithia was Anne’s favorite book as a child.” I’m just not familiar with copyright in literature as most of my knowledge is related to music.

And that’s all I have! Comments, questions, concerns? I’m open to feedback! Thank you for your time :slight_smile:

5 Likes

For presumably everything copyright related with regards to U.S. law:

https://www.copyright.gov

1 Like

I’ve already done some minor research regarding the topic. Unfortunately the copyright website, being a government website, is equally helpful as it is confusing. It seems the debate is between “what is fair use” and what level of copyrights/trademarks contradict it. There’s cases that have been won in both party’s favors regarding it so it’s extremely confusing but relevant if I plan on writing relatable content for a modern-themed novel. I’m really looking for opinions from authors that have experience with this type of copyright. From what I understand, referencing names and specific content from others’ works (without directly quoting or using lyrics, etc.) is considered “fair use” but, again, indictments have been made.

Is there a reason you couldn’t obscure the actual name?
For example…

“Josh loved that wizard book immensely when he was younger.”
Which “wizard book” am I talking about?

Oh, I completely agree with you but how many of my potential readers are going to be familiar with Harry Potter? It’s like saying “that famous nu metal band from the early two thousands” or “sci-fi film” how obscure is too obscure? How could I, for example, obscure Star Wars? Disney’s trademarked almost everything correlating to those films and there were a multitude of popular nu metal bands back in the day (Korn, Slipknot, Linkin Park, etc.)… Direct references are both relatable and very easy to manage. I’m just trying to understand if its truly fair use or if I absolutely must obscure them to protect myself.

Well, here’s something obscure…
John: “Hey Susan, you know about that “Star Wars” defense program that President Reagan instituted back in like 1983?”
Susan: “Yeah, of course I do. What about it?”

It’s just a matter of what you’re trying to reference, then analyzing why you’re trying to reference it in the first place.
Just because a certain audience may relate to a popular reference, I feel that is less important than focusing on what an author is actually trying to say to said audience.

Hm, that’s a pretty good point I didn’t think of. To be honest, any references I can think of that would relate to my plot point are related to works that are in public domain so I’m not worried about those. Honestly, it was just quick/easy descriptors detailing scenes. “You groan as Sophie raises the volume of her radio now playing Taylor Swift.” Just fast ways of making scenes relatable for the reader while allowing me to usher details with a bit more flexibility… If that makes sense.

You know, I would really like to read a story where a character who doesn’t like a band or group says as much, but explains why in as much detail as you would read in a music major’s college-level paper.

Then the person they’re explaining it to has a rebuttle.

Then the two of them have a dance contest!

(No, not really. Just kidding.)

But what’s the story you’re trying to tell?
What kind of story is it?
How far along is it in development?

It’s conceptual at this point, I’m currently outlining. The concept is modern/present day where nine seals have started opening one-by-one across the world and the international governments have been covering it up. The prologue I plan on writing will follow a cryptic archaeologist (you) headed to Antarctica which has been cordoned off by the US government as it is the final seal still locked. No one knows what’s going to happen when all the seals open but they’re not waiting around and have hired you along with a team of experts to figure it out before it’s too late.

That’s just the prologue for a more, expanded concept. But there’s a lot of referencing of Dante, Nostradomus and Virgil. The prologue will be a horror/thriller.

1 Like

Ok, see, I would read that book.
In the development of the story, make sure you get all the big issues out of the way first.
You may end up not even needing to make a specific reference, if it doesn’t directly help the plot / pacing / character development / etc.

Awesome! That’s great to hear - glad I’m onto something :stuck_out_tongue:

Yes, definitely. I have a lot of conspiracy concepts I’m going to play with (Area 51, the Pyramids, Chernobyl, etc.) with correlation to historical events. I won’t have any issues referencing historical literature as it’s public domain.

You’re absolutely right, I don’t need these references they’re just a simple way to relate the audience to the setting. I appreciate your help! :slight_smile:

1 Like

I have this idea in my head that story development can be analogous to building a house.

  1. Site Prep.
  2. The Foundation.
  3. Framing
  4. (Wondering where the architect’s blueprints come in… oh well, writing is recursive and we can rearrange things!)
  5. When does the sheet rock come in?
  6. Plumbing?
  7. Electrical?
  8. Roofing?
  9. How many rooms?

A few things:

  1. The Clock - it’s the last seal and there’s an automatic race against the clock. Some of the exposition should be devoted to explaining how much time is left, and why this particular main character (MC) is coming into the picture so late.

  2. Why Antarctica? Or does that get revealed after the archaeologist tracks different seals through different countries?

  3. Why is the threat credible? What actually happens to make governments cover this up?

  4. Is the MC solely qualified to bring about change and stop the last seal or is the MC replaceable? What sort of knowledge or skillset would they have to have? Same question for the MC’s team.

  5. How realistic will the story be? Using something like Robert Langdon’s films (Dan Brown’s stories) as a reference: The Da Vinci Code; Angels & Demons; Inferno

I have been a huge sucker for horror films since I can remember while also contributing a lot of my fandom to directors like Quentin Tarantino (I know, not horror but conceptually), James Cameron, Sam Raimi… The list goes on. I like attention to detail - limited holes in the plot and relatability to the audience. I’ve always wanted to build on a cult-following concept. So, with Dan Brown in mind (absolutely) or even a bit of correlation with Michael Crichton (Timeline, Jurassic Park, etc.) as definite inspiration in writing this…

For 1 & 2, those particular questions will be answered in order of 2 then 1 as the PC progresses through the story. Basically, I want to open up with you presenting to a university forum the concepts of Hell as that has been your major focus of study (you wrote your doctoral thesis on why Dante’s Inferno isn’t a myth). This is one of the major reasons why you’ve become a prime candidate for the governments.

  1. There’s no credible information (up front) that will relate the PC to what the threat is though the hint is obvious. (I’m not to worried about breaking information on this as the major spoilers are much more significant) These seals have been discovered through generations, modern discoveries like Chernobyl were based on the amount of chemical energies released from these seals. Using Chernobyl as an example: it wasn’t a nuclear power plant, it was a research facility focused on the origin of the seal as well as utilizing the alien energies to become a potential fuel source. It’s only natural for governments to cover up what they don’t know. Now, the Russians advanced significantly into their research before Chernobyl fell (because the seal opened - when this happens it’s catastrophic - aka nuclear explosion?) and had passed their information on to other governments in a collaborative attempt to get answers. So, on one end, it’s greed in dispute with fear of the unknown. I would still like to flesh this idea out more.

  2. I kind of covered this already. Again, on a political level, governments tend to stray away from answers of religious fashion which is why you’re an exception. You are an atheist, however; you have no doubt in your mind that Hell exists through your archaeological research in Egypt and South America (Mayan pyramids). The team that’s attached to you will be a archaeolexicologist (as the seals reveal some interesting writings), paranormal investigator (again, the government is paranoid - with no true answers as to what lies beneath), cardinal from the Vatican (we need information held within the vaults) and a survivor from Chernobyl (who’s been working with the government since the blast). I’m still deciding on additional (if any) professions that would need to be involved.

  3. I’m definitely leaning more into Michael Crichton and Dan Brown for sure. Real enough to feel believable but fictional enough to keep your anxiety away from your heart!

*the list should be 3, 4, 5 but the forums is forcing them into a list - apologies!

1 Like

In my experiences, simple pop-references and name-dropping are covered by fair-use.

Here is a link, you should find helpful:

The game design docs and guidelines should be a start for the basics.

I’d suggest you develop your story from an instinctual perspective - your background in lyrics should be enough to warn you when/if you have a question and running those by the community should provide feedback enough to get an idea. Eventually, you can even put a demo/beta up for feedback and testing.

To get an idea of how this works, you should visit the WiP sub-forum and sample a few active works, and there is the specific fora for code, off-topic and general game development.

You can also, once you have been a community poster for a bit, private message people if you have specific questions or concerns (including me) … most are very open, welcoming and helpful here.

1 Like

Thank you for your feedback!

I’ve definitely spent some time looking through the Choicescript documentation. The only thing close to my function concept was “*script” or building it into Java for your own, personal use (I’ve seen some of the save mods people have designed). The only issue with these are the exclusivity of them and I was basically making an attempt of a “suggestion.”

It’s good to know that fair-use still holds some ground in regards to references and I will definitely be sure to make that a focus in future testing. I’ve been going through some WiPs on the forums and will definitely spend some time evaluating the work of others before I make a full commitment of my own. My own personal logic: even if it’s your first time, go all out. Try to get as much right and as much wrong as possible in order to learn the most.

1 Like

Just mentioning a published work is fine. A short quote is usually fine if it’s attributed. You run into trouble if you quote a published work without naming the source, or if you quote something at length (e.g., use song lyrics.)

When Stephen King mentions Coca-Cola or Star Wars, it’s fair use. When he quotes songs and poems at the beginnings of chapters, he got permission for that.

1 Like

Not that I’m advocating against functions in ChoiceScript, but *gosub and *return are adequate for most use cases, if a little less tidy.

In a compiled game there’s nothing stopping you from having a functions.txt containing all of these.

Major downside is you need to define some global arg and ret variables, to hold the function parameters and return value.

Usage e.g.

*set arg_count 3
*set arg1 4
*set arg2 7
*set arg3 2
*gosub_scene functions avg
Result is ${ret}
2 Likes

As a person with a programming background, I have done basically what @CJW mentioned above, except I named my argument variables to take advantage of the array functionality, and I also have a separate scene just for my global functions. Also, I don’t know if it’s any different with compiled projects, but using goto/gosubs to form loops will produce noticeable lag. The password system I made in pure choicescript has a lot of loops and goto/gosubs, and in my stress test, it created a lag of about 30 seconds based on the number of variables Zombie Exodus saves for checkpoints.

1 Like

From what you both explained… is that something that works implicitly with just Choicescript or is there some sort of modification to the source code? If it’s a mod that goes back to my whole “exclusivity” argument that the end user wouldn’t be able to run your story, no? Or if you want it published?

That’s all possible with standard ChoiceScript. @stainedofmind Compiled games load all the scenes into memory so the delay is typically negligible.

3 Likes