Jump to content
Sign in to follow this  
Gemintronic

Having trouble updating 3rd & 4th score digit

Recommended Posts

So, in my latest game I'm having trouble updating the 3rd and 4th digit in the score. I'm using it as an inventory bar.

 score = 0
 if has_sword then score = score + 100000
 if has_shield then score = score + 20000
 if has_ring then score = score + 3000
 if has_food then score = score + 400
 if has_potion then score = score + 50
 if has_scroll then score = score + 6

When I attempt to update it this way it just doesn't go. If I later go "score = 3400" then it appears to work correctly. Is this the wrong way to try an inventory bar using the score? Is there a better way?

 

 

atarowg11.bas

Share this post


Link to post
Share on other sites

BCD mode seems to enabled and disabled around the adds to the score so I'm not quite sure what the problem is ast the moment.

  • Like 1

Share this post


Link to post
Share on other sites

What is happening in this game? Am I supposed to find items/treasure chests? Am I suppose to fight that creature and he drops something?

 

 

I ran around the game for a long time, and tried fighting the creature with the firebutton, but nothing happened. I did this with a breakpoint in Stella at your score code, and found that you never reach there. So I think you got some logic errors that is not letting you even get to that code.

Share this post


Link to post
Share on other sites

What is happening in this game? Am I supposed to find items/treasure chests? Am I suppose to fight that creature and he drops something?

 

 

I ran around the game for a long time, and tried fighting the creature with the firebutton, but nothing happened. I did this with a breakpoint in Stella at your score code, and found that you never reach there. So I think you got some logic errors that is not letting you even get to that code.

 

Eventually you find rooms with treasure chests. The treasure chest will have a random item 1-6 that gets added to your inventory bar. When testing I just hit F2/reset until a chest appeared nearby. Thanks for taking a look :)

 

This is my attempt at a 7 day Rogue-like. It's pretty far from finished. All you can do is go down stairs and nab items from an occasional treasure chest.

 

I kind of underestimated the potential for roadblocks like not being able to manipulate the score correctly.

Share this post


Link to post
Share on other sites

You can't directly assign a variable to the score, so at the very least, this line is messing up the score...

 

score = enemyhp

 

...if you really want to do that, use score=score+enemyhp. But be sure enemyhp is a BCD value.

Edited by RevEng

Share this post


Link to post
Share on other sites

rand&5 will produce one of four values 0,1,4 or 5

 

you'll never see 2 or 3

this should work

temp1 = rand/2 : temp1 = (temp1/2 + temp1)/32
Edited by bogax
  • Like 2

Share this post


Link to post
Share on other sites

 

rand&5 will produce one of four values 0,1,4 or 5

 

you'll never see 2 or 3

this should work

 

temp1 = rand/2 : temp1 = (temp1/2 + temp1)/32

 

 

YOU. GUYS. ROCK!

 

This was the solution. I'm very, very grateful for the posts here. Even the people who didn't post and just simply considered my quandary like Random Terrain and Andrew Davie. Thanks 'yall :)

 

UPDATE: Is this never-see-a-2-or-3 a symptom of using foo&5? Or, is it something in how rand generates its results?

Share this post


Link to post
Share on other sites

It's a symptom of using foo&5.

 

The & trick to reduce the number range only properly works with 1, 3, 7, 15, 31, 63, 127. (i.e. powers of two, less one)

 

See the "did you know" box in the random number section of RT's site for more info.

Edited by RevEng
  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...