Creating some math for election

I want to create polls and election results by multiplying the percentage a group makes up of a state’s population, and multiplying that by the approval rating of that group.

I’ve only tried it with one group so far to make sure it works but nothing is. I’m not finding anything in the tutorials that really relates to this so I’m worried it’s not even possible. If there’s an easier way can you suggest it below?

The error I’m getting is:…

My code looks like this:

[b]Ohio[/b]
*set calc = unions
*set calc = calc*0.35
*set ohio += calc
${ohio}

The error is:
“line 483 of startup: Invalid expression at char 6, expected number, string, var, or parenthetical, was: EQUALITY [=}”

one more thing, line 483 is the first *set

one more more thing is that the “0.35” is the percent the Unions make up of this particular state. I think thats all the information needed

first of all, drops the “=” part, you only need “=” for IF-ELSE conditions
example → IF calc = “unions”
to set a variable, simply write *set calc “unions”

second, the variable calc, is it declared to contains numbers or texts?
because you try to set calc with “unions”, it’s a text
then you try to multiply it with 0.35
I don’t understand what are you trying to do, please explain more

Forgive me if I’m wrong, but wouldn’t you just multiply the population, by the percent of the population the faction is composed of, and then again by the approval rating percentage? And then round the result?

This is extremely sloppy, and sorry if I misunderstood what you’re doing, but wouldn’t it just be this?

*create result 0
*create population 1000000
*create group_percent 0.5
*create approval_rating 0.75
*set calc round(population * (group_percent * approval_rating))
${result}

for the purposes of this, population is a hypotehtical population of ohio, group_percent is the percent of the ohio population the faction is composed of and approval rating is that group’s approval rating.

Unions is also a number, not a text. Calc is just to hold numbers. So let’s say you have a 70% approval rating with the unions, and they’re 35% of the states population. So you just won 70% of 35%. Tally that up with the other groups and we know who has won.

As for your suggestion with the state numbers that might work. I’ll tinker with it and see if that comes out any better. Ideally I want to display everything as percents so you have a grasp of how well you won or lost

Got it to work. Your suggestion worked @dreamofeden. For now I won’t be including populations till the end but this was all it needed:

*set calc  (0.35 * conservatives)
*set ohio + calc

That continues for each group based on what their percentage of the population is.

I don’t want to clog up the forum by creating another post, but hoping I’ll find help here:

"This pledge, that I make to you, is of course not my only vow to you, the American people. I have a full agenda, that we will go to work implementing on the very first day. Just as FDR had the New Deal, and Kennedy had his New Frontier, I give you my agenda, the…"
*choice
    #"...Real Deal."
        *set agenda "Real Deal"
        *goto 5th
    #"...${surname}nomics"
        *set agenda ${surname}nomics
        *goto 5th
    #"...Freedom Frontiers."
        *set agenda "Freedom Frontiers"
        *goto 5th
    #I'd like to name my own agenda.
        *input_text agenda
        *goto 5th

You might already see the problem with this in the second choice where I want to set the last name variable combined with some more text. It gave me an error:
image
Is this fixable or even possible within the code?

quotations

*set agenda "${surname}nomics"
1 Like

Damn you are the MVP eden