To Chain_Reaction or anyone else who can handle the code

The original catch all. General game help, banter, things you should probably put in the correct forum, This is the place.
Post Reply
KittyTheSnowCat
Reactions:
Posts: 647
Joined: October 1st, 2015, 6:00 pm
Answers: 3

To Chain_Reaction or anyone else who can handle the code

Post by KittyTheSnowCat » June 15th, 2019, 4:24 pm

Hi Chain or any other hero,
can someone fix one little thing in the Nraas Vector code for me, or do I have to learn how to import gitprojects into MonoDevelop? (Please don't make me do that, I want to fuddle around with things that influence the game directly in my sparse time right now) :cry:
The GetNextStage function in NRaas.VectorSpace.Stages.WeightedStage throw an Array out of bounds error.
This:
int result = RandomUtil.GetInt(mTotalWeight);
needs to either be
int result = RandomUtil.GetInt(mTotalWeight-1);
or
if (current > result) break;
needs to be
if (current => result) break;

Pretty pleeeeeease?
Snow

User avatar
Chain_Reaction
Site Admin
Reactions:
Posts: 7568
Joined: December 30th, 2011, 6:00 pm
Answers: 81
Contact:

To Chain_Reaction or anyone else who can handle the code

Post by Chain_Reaction » June 15th, 2019, 6:31 pm

So I'm not super clued on on Vector as I've done very little work with it but I haven't seen anyone else with the issue. Why is it breaking for you? Are you making your own disease?

KittyTheSnowCat
Reactions:
Posts: 647
Joined: October 1st, 2015, 6:00 pm
Answers: 3

To Chain_Reaction or anyone else who can handle the code

Post by KittyTheSnowCat » June 15th, 2019, 6:43 pm

Noone else has this issue because in the diseases available here, WeightedStage isn't used. Yes I am making my own disease or rather changing the Common Cold for now. I want the herbs from university to be more useful and less cheaty. so I am repurposing them as medicine.
Basically the broken function takes a random number from 0 to the number of next stages and then goes through them.. in a loop. Packs the next stages into an array. But Since array indexes start at zero whenever it picks the highest number it is out of bounds. Noone ever notices because there are no diseases yet that use that Stageclass.

KittyTheSnowCat
Reactions:
Posts: 647
Joined: October 1st, 2015, 6:00 pm
Answers: 3

To Chain_Reaction or anyone else who can handle the code

Post by KittyTheSnowCat » June 16th, 2019, 12:25 am

Just to be clear. I am looking for someone who has the whole development environment set up and can therefore quickly correct this and compile. In that case since I already wrote down the two options to fix this that should not take a lot of effort.. If noone has a fast way to do it I will do it myself.

KittyTheSnowCat
Reactions:
Posts: 647
Joined: October 1st, 2015, 6:00 pm
Answers: 3

To Chain_Reaction or anyone else who can handle the code

Post by KittyTheSnowCat » June 16th, 2019, 1:24 am

Hmm no idea why I remembered that as super difficult.. I just nḱnow I never got Nraas projects to compile with Visual Studio..
I just compiled a corrected Version of Vector though. :-o

User avatar
Chain_Reaction
Site Admin
Reactions:
Posts: 7568
Joined: December 30th, 2011, 6:00 pm
Answers: 81
Contact:

To Chain_Reaction or anyone else who can handle the code

Post by Chain_Reaction » June 16th, 2019, 3:12 pm

I was going to but glad you got it sorted. :)

KittyTheSnowCat
Reactions:
Posts: 647
Joined: October 1st, 2015, 6:00 pm
Answers: 3

To Chain_Reaction or anyone else who can handle the code

Post by KittyTheSnowCat » June 17th, 2019, 6:06 am

Well I was just trying it again to remember what the problem was when I tried it years ago on Windows + Visual Studio. I only remember it not working..
But on Linux + MonoDevelop all I had to do is relink some dependencies.
Maybe I was too stupid some years ago, maybe there was a bug, long story short, I can play around with the NRaas code now (and this is where you should scream out in terror^^)
My disease works beatifully now without error messages now, I just have to rebalance the resistances a bit.

Post Reply