Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Freyaday on March 23, 2011, 04:19:33 pm

Title: Mismade
Post by: Freyaday on March 23, 2011, 04:19:33 pm
Something is wrong here, because I seem to be creating the uservars improperly.
Code: [Select]
Zeros(9)->Z
GetCalc("varC")->A
float{A}->C
...stuff...
GetCalc("varW",18)->A
W->float{A}
This is just the relevant parts, although I am not sure if I left anything out that needs to be here.
Title: Re: Mismade
Post by: Deep Toaster on March 23, 2011, 04:34:59 pm
Something is wrong here, because I seem to be creating the uservars improperly.
Code: [Select]
Zeros(9)->Z
GetCalc("varC")->A
float{A}->C
...stuff...
GetCalc("varW",18)->A
W->float{A}
This is just the relevant parts, although I am not sure if I left anything out that needs to be here.

W (the Axe variable) doesn't seem to be defined.
Title: Re: Mismade
Post by: jnesselr on March 23, 2011, 04:35:50 pm
I think he's thinking that varC defines C and varW defines W.
Title: Re: Mismade
Post by: Deep Toaster on March 23, 2011, 04:37:03 pm
Maybe he was trying to do C->float{A}?
Title: Re: Mismade
Post by: Freyaday on March 23, 2011, 04:40:28 pm
No, I edited that part out. To give some context, this is a search engine for an AI I made, and W is one of the variables it returns, and no, it is not C.
Title: Re: Mismade
Post by: FinaleTI on March 23, 2011, 04:52:56 pm
Something is wrong here, because I seem to be creating the uservars improperly.
Code: [Select]
Zeros(9)->Z
GetCalc("varC")->A
float{A}->C
...stuff...
GetCalc("varW",18)->A
W->float{A}
This is just the relevant parts, although I am not sure if I left anything out that needs to be here.
I used to have a similar problem, until Quigibo helped me.
First, you don't need to define a real var's size, it's always the same.

Second, when you reference a real var, you need to subtract 2 from the pointer.
So instead of this:
Code: [Select]
GetCalc("varW",18)->A
W->float{A}

Try this:
Code: [Select]
GetCalc("varW")->A
W->float{A-2}

I believe this should work.
Title: Re: Mismade
Post by: Deep Toaster on March 23, 2011, 04:56:26 pm
I used to have a similar problem, until Quigibo helped me.
First, you don't need to define a real var's size, it's always the same.

Second, when you reference a real var, you need to subtract 2 from the pointer.

Ah, so even though real vars don't have size bytes, Axe still adds two when returning a value with GetCalc(? That's a bug :-|
Title: Re: Mismade
Post by: Freyaday on March 23, 2011, 05:00:22 pm
I thought you had to subtract something. But if don't put the ,18 will Axe still know I'm trying to create the variable instead of find it?
Title: Re: Mismade
Post by: Runer112 on March 23, 2011, 05:15:43 pm
Here are the things that seem odd/problematic to me:



Here would be my suggested code for what I have interpreted as what you meant to do:

Code: [Select]
.Not sure what this line is for.
Zeros(9)→Z

.Don't forget error handling!
!If GetCalc("varC")
   .You'll want code here that either jumps to a unified error handler or handles the error itself and returns/quits.
End

.Unless you plan on using the pointer to the OS variable C later, no need to store the GetCalc() result to a variable, you can just carry it right into the float{} command. Also added a -2 to correct for GetCalc() problems.
float{-2}→C

...stuff...

.More error handling! Also changed the size argument to account for GetCalc() issues.
!If GetCalc("varW",9-2)
  .More error handling.
End

.Save the pointer to the OS variable because we can't just carry it straight into the float command this time. Also subtracted 2.
-2→A

.Store the Axe value W into the OS value W
W→float{A}

Hopefully this will work. Tell me if you have problems with it.
Title: Re: Mismade
Post by: Freyaday on March 24, 2011, 01:02:04 am
Now I have another problem (different pgrm)
This one is a sprite editor, but I can't get it to make the output string properly.
Code: [Select]
[303132343536373839414243444546]->GDB1
...muchness of stuff...
GetCalc("Str1",16)->A
For(N,0,1
0->B
For(P,0,15
For(Q,O,3
If pxl-test(P*4+Q^8+87,P*4+Q/8+46+(N*9
e^(3-Q)+B->B
End
End
{GDB1+B}->{A+P}
End
GetCalc("Str2",16)->A
End