Author Topic: What is wrong with this code? :(  (Read 11442 times)

0 Members and 1 Guest are viewing this topic.

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
What is wrong with this code? :(
« on: January 11, 2011, 06:40:39 pm »
http://pastebin.com/pR57e81a

This is giving me a headache. It's supposed to give me walls being drawn, getting progressively farther away, being detected off a pic, but It's not showing anything, probably due to a mistake in the formula that I can't find.  :mad: :banghead:

Anyone have any helpful ideas/suggestions? even a completely new formula, I just want it to work.

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: What is wrong with this code? :(
« Reply #1 on: January 11, 2011, 06:54:01 pm »
I think the main part of your problem is that in this line of code:
Code: [Select]
If {PY*96+PX+(A*96)+GDB1+F}=1
I think you're trying to check bit by bit for the location of a wall, but when you access data using curly braces, it returns the value of the byte.

Also, try closing your parenthesis - leaving them open in Axe can cause issues.

Also, I didn't know that you could use variables created using more then one letter.  Does that really work?
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: What is wrong with this code? :(
« Reply #2 on: January 11, 2011, 06:55:56 pm »
In axe it does I think (hope), unless the Pic1xX thing only applies to other variables. maybe that's the issue. I actually changed that = to a >= so it would work that way. I'll try changing it to just X and Y.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: What is wrong with this code? :(
« Reply #3 on: January 11, 2011, 06:59:47 pm »
What's PY and PX? If you're trying to do P*Y and P*X, remember that Axe doesn't support implicit multiplication.




Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: What is wrong with this code? :(
« Reply #4 on: January 11, 2011, 07:40:49 pm »
No, I was doing PY as one var and PX as one var. They are the player's coordinates on the pic var.

Offline FinaleTI

  • Believe in the pony that believes in you!
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1830
  • Rating: +121/-2
  • Believe in the pony that believes in you!
    • View Profile
    • dmuckerman.tumblr.com
Re: What is wrong with this code? :(
« Reply #5 on: January 11, 2011, 07:58:48 pm »
Try Y instead of PY and X instead of PX. I don't think Axe supports multiple letter variables like it does with static pointers.
« Last Edit: January 11, 2011, 07:58:59 pm by FinaleTI »


Spoiler For Projects:

My projects haven't been worked on in a while, so they're all on hiatus for the time being. I do hope to eventually return to them in some form or another...

Spoiler For Pokemon TI:
Axe port of Pokemon Red/Blue to the 83+/84+ family. On hold.

Spoiler For Nostalgia:
My big personal project, an original RPG about dimensional travel and a few heroes tasked with saving the world.
Coding-wise, on hold, but I am re-working the story.

Spoiler For Finale's Super Insane Tunnel Pack of Doom:
I will be combining Blur and Collision Course into a single gamepack. On hold.

Spoiler For Nostalgia Origins: Sky's Story:
Prequel to Nostalgia. On hold, especially while the story is re-worked.

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: What is wrong with this code? :(
« Reply #6 on: January 11, 2011, 08:00:16 pm »
That only works for static pointers becasue those don't take up any memory.  I only have a limited number of variables because I want to leave users with enough free ram to play around with.  If you need more variables, you can always use these ram locations manually: {L1+10}r for instance will act exactly the same as a regular variable (make that 10 any constant you want as long as it fits in ram)
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: What is wrong with this code? :(
« Reply #7 on: January 11, 2011, 08:36:09 pm »
Yeah, I tried with X and Y, no change at all. I also made sure that it was detecting something at one point, by forcing the If function.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: What is wrong with this code? :(
« Reply #8 on: January 11, 2011, 09:36:34 pm »
Are you sure you  changed all the PXs and PYs to Xs and Ys?

Also,

Code: (Axe) [Select]
If {Y*96+X+(A*96)+GDB1+F}=1

would be a lot more optimized as

Code: (Axe) [Select]
!If {Y+A*96+X+F+GDB1}-1

Taking out those parentheses in particular helps a lot :)
« Last Edit: January 11, 2011, 09:36:58 pm by Deep Thought »




Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: What is wrong with this code? :(
« Reply #9 on: January 12, 2011, 09:30:50 am »
Umm, those two lines don't do the same thing.

Y+A*96 != Y*96+A*96

I tried it in my calc, no change :( The paste has the old, my calc has yours DT

And yes, I got all the PX's and PYs, they're only referenced in the one line anyways :P

By the way, an updated paste http://pastebin.com/TGSqGSJ8

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: What is wrong with this code? :(
« Reply #10 on: January 12, 2011, 11:43:38 am »
Umm, those two lines don't do the same thing.

Y+A*96 != Y*96+A*96

It's the same because there's no order of operations in Axe, remember. It goes strictly from left to right.




Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: What is wrong with this code? :(
« Reply #11 on: January 12, 2011, 01:15:58 pm »
Deep Thought is right AFAICT.
"Y+A*96" evaluates as "(Y+A)*96", which is the same as "Y*96+(A*96)"
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: What is wrong with this code? :(
« Reply #12 on: January 12, 2011, 01:22:27 pm »
XCB doesn't multiply X by C by B?

Shocking news!: That's why many of the games I attempted never worked and kept giving me errors... I never thought it was this part of the code because I assumed it was OK.

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: What is wrong with this code? :(
« Reply #13 on: January 12, 2011, 01:24:52 pm »
Indeed, Axe doesn't have implicit multiplication. In fact, if you have, say, "ABC" in your code, it will evaluate just like C alone would, but more slowly. (Since it loads A, then B, and finally C) ;)
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: What is wrong with this code? :(
« Reply #14 on: January 12, 2011, 01:25:32 pm »
Indeed, Axe doesn't have implicit multiplication. In fact, if you have, say, "ABC" in your code, it will evaluate just like C alone would, but more slowly. (Since it loads A, then B, and finally C) ;)

I thought it loaded A. This is where the NSpire Basic wins: multiple character variables.