inkle / inkle/inky

[Beginner's Question] How do I compare variables and divert from the highest/lowest?

Open
#363 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.7k
Forks
340
PR merge metrics
No merged PRs in 30d

Description

Please forgive me if this is obvious but I am a novice to programming and I am not smart enough to figure out an answer to this from github thus far.

In my game I have various "personality" stats that I am tracking as integer variables. For example:

VAR Diplomacy = 0
VAR Investigation = 0
VAR Deception = 0
VAR Intimidation = 0

Different choices boost the values of these variables. For example:

*[Talk it out]
~ Diplomacy = Diplomacy +1
*[Dig through his trash]
~ Investigation = Investigation +1

Now my question: At different points, I would like the character diverted into particular knots/stitches based on whichever of these variables is higher. So for example, if after making choices the character has these stats:

VAR Diplomacy = 2
VAR Investigation = 1
VAR Deception = 0
VAR Intimidation = 4

Than in this case, the player should be diverted to the "Intimidation" path.

The problem is, this doesn't seem to work the way I set it up. If I use && for this logic, I cannot move past this checker.
{
-Diplomacy > Investigation && Deception && Intimidation:-> PathA
-Investigation > Diplomacy && Deception && Intimidation:-> PathB
-Deception > Diplomacy && Investigation && Intimidation:-> PathC
-Intimidation > Investigation && Deception && Diplomacy:-> PathD
}
I thought this would work but I get a "ran out of content" error.
If I use ||, than Diplomacy will be selected since it is higher than Investigation or Deception, which I don't want.

I know for sure that I have successfully implemented the variables and modifiers as I have tested for them. What I want is for all these four variables to be compared and the highest one selected.

Thanks so much for any help you are willing to offer!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.