Ultimate Noob Coding

Yeah, how I wrote it, I don’t want to player to return to that point anymore as he does not wants to interact with the met character. I think I just overcomplicated it all. I will follow @Szaal 's advice and finish what I have in the coming week and post it.

Thanks for helping :slight_smile:

2 Likes

Years later, I know, but thanks for typing this out: clear, concise–exactly what I needed. Cheers!

2 Likes

What’s the coding for money? i.e. A resource that’s shown in your inventory, which you can’t spend more of than you possess.

2 Likes

just set a variable and name it whatever you want. for an example of not spending more than what you have:

*fake_choice
   #Buy a dope fanny pack
      *if money > 10
         Nice! You got a new fanny pack! Pretty dope!
      *if money < 10
         Bummer dude.... no fanny pack for you! You need some money. 
    #Don't buy a dope fanny pack

just change out the values and text, that will work for most things

2 Likes

So. I made a highest_calc script, and want to see what everyone thinks. Please comment if you find arrors.

*if Highest_relationship_stat = 51
	*set Highest_relationship "t_relationship"
	*set Highest_relationship_stat t_relationship
*elseif friendship_stat =50
	*set friendship_stat "l_relationship"
	*set friendship_stat_stat l_relationship
*if t_relationship > Highest_relationship_stat
	*set Highest_relationship "t_relationship"
	*set Highest_relationship_stat t_relationship
*elseif ((t_relationship >friendship_stat_stat and <highest_relationship_stat
	*set friendship_stat "t_relationship"
	*set friendship_stat_stat t_relationship
*if l_relationship > Highest_relationship_stat
	*set Highest_relationship "l_relationship"
	*set Highest_relationship_stat l_relationship
*elseif ((l_relationship >friendship_stat_stat and <highest_relationship_stat
	*set friendship_stat "l_relationship"
	*set friendship_stat_stat l_relationship
*if n_relationship > Highest_relationship_stat
    *set Highest_relationship "n_relationship"
    *set Highest_relationship_stat n_relationship
*elseif ((n_relationship >friendship_stat_stat and <highest_relationship_stat
	*set friendship_stat "n_relationship"
	*set friendship_stat_stat n_relationship
*if d_relationship > Highest_relationship_stat
    *set Highest_relationship "d_relationship"
    *set Highest_relationship_stat d_relationship
*elseif ((d_relationship >friendship_stat_stat and <highest_relationship_stat
	*set friendship_stat "d_relationship"
	*set friendship_stat_stat d_relationship
*return
*gosub_scene high_relationship_calc

*if Highest_relationship = "t_relationship"
    *goto_scene driver t_reaction_shoulder2
*elseif second_highest_relationship ="t_relationship"
	*goto_scene driver t_reaction_shoulder2

*if Highest_relationship = "l_relationship"
     *goto_scene driver l_reaction_shoulder2
*elseif second_highest_relationship ="l_relationship"
	*goto_scene driver l_reaction_shoulder2

*if Highest_relationship = "n_relationship"
     *goto_scene driver n_reaction_shoulder2
*elseif second_highest_relationship "n_relationship"
	*goto_scene driver n_reaction_shoulder2

*if Highest_relationship = "d_relationship"
     *goto_scene driver d_reaction_shoulder
*elseif second_highest_relationship ="d_relationship"
	*goto_scene driver d_reaction_shoulder2

So. Yeah.

2 Likes

Hi @ArchivistAlpha096 , congratulations for your effort. I had a look at it, but the code is very dense and rather hard to analyze. Where are the two constants 51 and 50 coming from?

For sorting, I always refer to @stainedofmind 's implementation, which is in my opinion the most elegant piece of CS ever written. You can find it here: Algorithm hall of fame and code examples: sorting, shuffling, dev tools

2 Likes

The 50 and51 come from the 2 relationship stats. Figured I should the “highest_relationship_stat” 1 above the “friendship_stat” just to keep things focused.
Yeah, it is. I didn’t bother double spaceing it, because it’s ment to be strictly backround code.

1 Like

Ok, I’m confused. I’m running my code on firefox. Also. Seems it wants you to uploade the entire folder now, which I don’t like utch. Anyway. I have this:

		*set k_gender "female"

I don’t know why it’s giveing me an arror, and am somewhat confused as to what’s going on here? So… Yeah…

1 Like

Time to resurrect this for a little help: how do you code does not equal into an *if? I think it was something with an equal sign and a backslash but I don’t know specifics.

3 Likes

It’s !=

6 Likes

Thanks!

2 Likes

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.

Hello, various and sundry coders. I was doing some playtesting for my game in the publication queue and realized the below subroutine code doesn’t cover if someone has more than one of these stats at an equal level; an epilogue chunk failed to trigger because it required one of the four to be in place. Any thoughts on how to force it to pick one if there are multiple at an equal level?

*if Highest_stat = 0
    *set Highest_stat_type "Intimidate"
    *set Highest_stat intimidate

*if Intimidate > Highest_stat
    *set Highest_stat_type "Intimidate"
    *set Highest_stat intimidate

*if Inspire > Highest_stat
    *set Highest_stat_type "Inspire"
    *set Highest_stat inspire

*if Motivate > Highest_stat
    *set Highest_stat_type "Motivate"
    *set Highest_stat motivate
    
*if Entertain > Highest_stat
    *set Highest_stat_type "Entertain"
    *set Highest_stat entertain
    
*return
1 Like

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.

2 Likes

If these checks are part of the same logic, you should use elif instead of independent if statements. And like @Sinnie said add a final else.

If you are 100% sure the game can only be in one of these states, than instead of adding an else to the end, just replace the final elif for an else.

When you do this, the logic will always pick the first that matches and only the first.


CSLib has utilities for calculating the maximum number in a list. You might be interested.


I’ve posted a solution for checking the maximum value in an list before. You might be intereted:

2 Likes

Change > to >=.

Change ifs to elseifs and an else.

That’s your cheapest, simplest answer!

2 Likes

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.

2 Likes

Simple is good. Going to try this out. Thanks to all of y’all.

2 Likes

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.

2 Likes