Very quick thoughts.
I presume the epilogue text uses IF to see which is higher and displays the relevant text? You could have a final ELSE which either displays a default or uses RAND to select any of the texts that meet the criteria of bei g equal to the highest.
Does your code not have a highest stat value at all times though? Presumably as soon as one stat gets a value, your code will set it as the highest. That will then change over the course of the game. If at the end of the game there are two stats tied, then the highest stat will be whichever became the highest first? As the second one wasnt higher and didnt alter the variable.
Iām going to bed in a few minutes, but Iāll take a look tomorrow and see if I understand the problem (at a first glance it should always work by picking the first highest stat it encounters, in the oder of the ifs,but Iām prolly missing something).
The first if is redundant because you initialize it to intimidate so it does nothing.
I kind of solved something like that by checking equals before checking whoās greater than.
For my dice game, if all tie then thereās no need to check if someone wins, and if thereās a tie and no one got a better score then thereās a tie and no one wins.
There are 5 players in total, so first I check ties between 2, then 3, then 4 and finally 5. That alone are like 200 lines of code, but this one is maybe a little bit more complex cause it determines if thereās a winner above the ties.
Ok, Iāve run this code in a test project and it always picks a max. Are you sure that this is the reason why your epilogue is failing to trigger?
In a nutshell, what your code does as it is now is that it favors Intimidate if all other stats are equal, Inspire if it is highest and equal to motivate and entertain, etc.
Do you have 4 endings (1 for each stat) or more than 4 depending on the max stat combinations?
Through your
*if (Highest_stat_type = Intimidate)
reliance on brutality and fear tactics,
*if (Highest_stat_type = Entertain)
magnetic personality,
*if (Highest_stat_type = Motivate)
ability to push your people to do better while touting the value of the traditions in place,
*if (Highest_stat_type = Inspire)
daring rhetoric of change, which admittedly loses its luster as time marches on and you remain in power as a monarch,
you retain control of this kingdom for longer than you could have imagined.
This is the code. During a CSIDE playtest, it went straight from Through your to you retain control. Skipped all options.
It was an odd playthrough, in that I chose to overthrow Rod but ended up preventing the whole revolution and leaving him in. Which means this text never should have been visible but I had not yet accounted for that issue since Pacifist is a rare achievement (or at least, it should be). That part I did fix, but this bit with the highest stat was more complex.
Another question while I am prepping the files to be resent: how do you insert an image into the story? Never had to before, but I have cover art for both Cinderella and the prince, and since we are mostly using the Cinderella one for promo stuff I thought a good use of the dual images would be having them show up after the person picks which character they will play as.
With the command *image, then align to left, right, center, and then if you want a description for when the image canāt be shown for some reason, or for visually impaired people.
*image wolf.png center A lone, mangy wolf howling at the moonlight.
I think thereās another command *text_image or something like that, but I canāt find the documentation.
That code will never work because Highest_Stat_Type is a string and you are essentialy comparing a string to a number, you have to use quotation marks for it to work, like this:
The reason why you did not spot this error is that you also have variables named like that and quick test / random test did not detect the compilation failure. Iām going to assume you are not a coder by profession (I apologize if I am mistaken) and share with you a little secret of the trade: you will always make mistakes because you are human and itās important when writing code to put yourself in a position where you can spot mistakes easily/ make it hard to make mistakes in the first place.
When you are using ātypeā variables where you want to distinguish between discreet scenarios (in your case what is the highest type) I recommend you use numbers instead of strings. The reason for this is that if you use strings, you are potentially inviting typo errors.
For example,
*if (Highest_stat_type = āIntimidateā) ā if you misspell āIntimidateā to āIntiimidateā, you will have a hard time finding the error.
Instead, you can do something like this
Code
*comment -1 - Unitinialized
*comment 0 - Intimidate
*comment 1 - Entertain
*comment 2 - Motivate
*comment 3 - Inspire
var Highest_stat_type -1
...
*if Intimidate > Highest_stat
*set Highest_stat_type 0
*set Highest_stat Intimidate
*if Inspire > Highest_stat
*set Highest_stat_type 1
*set Highest_stat Inspire
*if Motivate > Highest_stat
*set Highest_stat_type 2
*set Highest_stat Motivate
*if Entertain > Highest_stat
*set Highest_stat_type 3
*set Highest_stat Entertain
*return
...
*if (Highest_stat_type = 0)
reliance on brutality and fear tactics,
*elseif (Highest_stat_type = 1)
magnetic personality,
*elseif (Highest_stat_type = 2)
ability to push your people to do better while touting the value of the traditions in place,
*elseif (Highest_stat_type = 3)
daring rhetoric of change,
*else
*comment keep this line only in the alpha/beta stage
Initialization error in highest stat check area, please contact the author.
A slightly better way of doing is this when they will add autocomplete to CSIDE (when you start writing a variable the editor will suggest variable names you previously declared) would be this:
Code
var Highest_stat_Int 0
var Highest_stat_Ent 1
var Highest_stat_Mot 2
var Highest_stat_Insp 3
var Highest_stat_type -1
...
*if Intimidate > Highest_stat
*set Highest_stat_type Highest_stat_Int
*set Highest_stat Intimidate
*if Inspire > Highest_stat
*set Highest_stat_type Highest_stat_Insp
*set Highest_stat Inspire
*if Motivate > Highest_stat
*set Highest_stat_type Highest_stat_Mot
*set Highest_stat Motivate
*if Entertain > Highest_stat
*set Highest_stat_type Highest_stat_Ent
*set Highest_stat Entertain
*return
...
*if (Highest_stat_type = Highest_stat_Int)
reliance on brutality and fear tactics,
*elseif (Highest_stat_type = Highest_stat_Ent)
magnetic personality,
*elseif (Highest_stat_type = Highest_stat_Mot)
ability to push your people to do better while touting the value of the traditions in place,
*elseif (Highest_stat_type = Highest_stat_Insp)
daring rhetoric of change,
*else
*comment keep this line only in the alpha/beta stage
Initialization error in highest stat check area, please contact the author.
The latter example, even though it takes longer to write has the advantage that if you decide to change values in the future, you change them only in one place and avoid errors that would appear by forgetting/missing places where the change should propagate.
In both examples, itās less error-prone because when you read the code, you have eliminated the source of error for typos and you will be more careful when writing the code because you have to check what those numbers mean in the comments and you are less likely to write on auto-pilot. (More modern languages have other more elegant ways of doing this, but they are not available in Choice Script so we have to make do with what we have).
I do not recommend implementing this best practice now because your game is already in queue and it might break other things, but I recommend you try it on your next project. Whenever you are writing code, think about āHow can I make it easier for me to spot errors?ā
Excellent catch. I had that code without quotes a bunch of places, too. I wonder why it never shows up that the text that they block off is unseen. In any case, I have it fixed and after a little more testing and the addition of the images, Iāll send off the new files.
As for not being a coder, thatās an offensive assumption. And by offensive I mean highly accurate. Iām an auditor by trade, and prior to coming here five years ago hadnāt touched a line of code since I was rejiggering the TI-83 games my genius friend made from scratch in high school around the turn of the century (and even then, I was never messing with the code itself, just changing what I now know to be the variables so that his Mega Man game suddenly became a Dragon Ball Z one). And really, my solution going forward will be to have subroutines even less whenever possible. I like to keep things simple, and itās worked moderately well so far. In this place, there are those who are gamemakers first and those who are writers first. Iām definitely more in the latter camp, at least to the extent I qualify for either.
Hi everyone! Figured Iād post my question here, sorry if it is somewhere else though. Would it be possible to have several relationship stats combine easily into one larger stat? For instance say three people are the leaders of this faction but since theyāre not ROās I could easily just hide their individual relationship stat with the MC from the stat screen but have their combined stats show as a whole of their attitude towards the MC.
ex: while npc[1] = 80, npc[2] = 40, npc[3] = 65, thatās a total 180/300 max = the faction would be at 60% but the individual characters would still have the relationship they have with MC. Just hidden from players because theyāre like background npcs mostly.
I just wanted to know if it was possible, if it would break fairmath, or if it would be too convoluted with the *create_array command.
With fairmath I think you only can go up to 100, so a solution would be to add up all 3 relations and divide them by 3 to get the average, just like your example, (80+40+65) /3 = 61.66, then you can use the *round command if you like to.
Oh awesome! Iāve never heard of the *round command but I did find it on the cog advanced choicescript page, I will definitely have to mess around with that to see if I can fully understand it. And yea fairmath I think is made to work to make sure you donāt pass 100. Most of whatās on the choice of games site about coding I understand easily except for a handful of things. Thank you @Loudbeat!
I cannot believe that searching for ā$!!ā in this thread actually got me the right answer to my question. Incredible work from four years ago, Szaal.
I wanted to check if a player got a code right, but I wanted it to work regardless of their capitalisation in *input_text. I wasnāt sure how to do it, but Iāve now figured it out, and it looks something like this!
Weed is not always the solution bro, Jesus loves you the way u are, whithout anything clouding your mind! (Unless u are hasta, in this case Jesus loves u even with the clouds in your head!)
Sorry for the Bad Religion (great band though) joke! Couldnāt resist!
Wait, what this ā$!!ā Do? Convert all the content in the adrss to an upper case equivalent??
I was kinda looking something like that a couple days ago. Iāve been trying to write a function that upon reading a word always pile it inside a string accordingly with the alfabetical order ā¦ the difference between the upper and low case of a same letter was making me confused.
Typing $!{variable} will make it so the first letter is capitalised. Using two exclamation marks capitalises the whole word. E.g:
$!{nesquik} = Nesquik
$!!{nesquik} = NESQUIK