Author Topic: how to make an appvar????  (Read 7059 times)

0 Members and 1 Guest are viewing this topic.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
how to make an appvar????
« on: October 02, 2010, 07:07:08 am »
hi
im currently programming an chemistry program and I was wondering how to make an appvar.
does anyone know how to do this???
it would help me out a lot
« Last Edit: October 02, 2010, 09:19:26 am by aeTIos »
I'm not a nerd but I pretend:

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: how to make an appvar????
« Reply #1 on: October 02, 2010, 10:14:01 am »
Hi!
Like this:


.TEST
"appvMY1STAPP"->Str1             The 'appv' at the front can be found by pressing [2ND] then 8.  
                                 Your appvar has to be a maximum of 8 characters long, and can include lowercase and numbers (I think?)

!If GetCalc(Str1)                This '!If' statement checks to see if your appvar already exists - if it doesn't, then GetCalc(Str1) will return 0.
GetCalc(Str1,16)->Z              This creates an appvar with a length of 16.  Note: if the appvar already exists, it'll delete it and replace it with the new one.
                                 Variable 'Z' is now a pointer to your appvar.
End

1->{Z}                           This stores 1 to the first byte of your appvar.  Think of it as {Z+0}.  A sixteen byte appvar will run from 0 to 15 (16 numbers total)
999->{Z+14}r                     This stores 999 to the last two bytes of your appvar - bytes 14 and 15.





I hope this helps!

Edit: Modified for clarity
« Last Edit: October 02, 2010, 10:49:47 am by Michael_Lee »
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 aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: how to make an appvar????
« Reply #2 on: October 05, 2010, 03:51:37 am »
thanks very much, it helped me out a lot
btw, your game is awesome!
I'm not a nerd but I pretend:

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: how to make an appvar????
« Reply #3 on: October 05, 2010, 04:40:20 am »
The only problem with that statement is this part:

!If GetCalc(Str1)
GetCalc(Str1,16)->Z

End


You should change it to this:

!If GetCalc(Str1)->Z
GetCalc(Str1,16)->Z
<Code for new appvar>
End


Most importantly is the ->Z after the first GetCalc().  Now in the case that the appvar IS found, Z points to it.  And of course when it is not found, it is created so Z always points to the data.  The other thing to keep in mind is that you might want to have some special code to take care of what happens when the appvar is created for the first time.  Usually, this involves filling in some default values to the appvar or maybe prompting the user for some input on how to format it or something.
« Last Edit: October 05, 2010, 04:40:43 am by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Aichi

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +76/-3
    • View Profile
    • Devrays
Re: how to make an appvar????
« Reply #4 on: October 05, 2010, 06:21:57 am »
Is it possible to sort 16bit numbers in an Appvar?
I tried this for example:
Code: [Select]
"appvTEST"→Str1
 Getcalc(Str1, 6)→A
4000→{A}r
2000→{A+2}r
5000→{A+4}r
SortA({A}r,6)→A
It didnt work, so I wrote an own Sorting Routine.
Regards,
Aichi
« Last Edit: October 05, 2010, 07:38:58 am by Aichi »

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: how to make an appvar????
« Reply #5 on: October 05, 2010, 10:06:14 am »
It probably doesn't work because, as of now, there's only a SortD() command ;)

Offline Aichi

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +76/-3
    • View Profile
    • Devrays
Re: how to make an appvar????
« Reply #6 on: October 05, 2010, 10:17:48 am »
@ Runer
It doesnt work too, if I use SortD.

Offline LordConiupiter

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 339
  • Rating: +3/-0
  • Just one of the thousands of Axe-fans...
    • View Profile
Re: how to make an appvar????
« Reply #7 on: October 05, 2010, 10:25:03 am »
I think you don't have to store the return value of SortD to A, since it doesn't return anything usefull :P
its also a single byte command, so it doesn't sort double-byte numbers.
this should work:

Code: [Select]
GetCalc("appvTEST",4)->A    .Don't forget to create an AppVar that doesn't exist by parsing the size as second parameter
40->{A}                     .All single bytes, no words
10->{A+1}
20->{A+2}
50->{A+3}
SortD(A,4)
For(I,0,3
Output(0,I,{A+I}>Dec        .Output all the values
End

EDIT: I tested it, and it works!
« Last Edit: October 05, 2010, 10:29:52 am by LordConiupiter »
everytime that I was down, you would always come around, and get my feedback on the ground. (modified part from 'Seasons in the sun')

No matter how many errors are bothering you, always try to stay rel-Axe!

The HoMM project will be resumed as soon Axe 1.0.0 will be released!
Projects:
Code: [Select]
HoMM:   [==--------]    Project 'resumed': I'm suffering overwhelming new ideas being popped up in my dreams :P
tiDE:   [----------]    Explored and understood the main part of the code: just started writing a Tokenizer.



password of the week: uvanapererubupa (Any pronunciation is the right one ;) )   :D click me, and you'll be raided :D

Offline Aichi

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +76/-3
    • View Profile
    • Devrays
Re: how to make an appvar????
« Reply #8 on: October 05, 2010, 11:03:08 am »
SortD is just able by using 8 Bit values? What a bummer.
I will still use my sorting routine.
« Last Edit: October 05, 2010, 11:04:00 am by Aichi »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: how to make an appvar????
« Reply #9 on: October 05, 2010, 02:07:47 pm »
SortD(A,4)r sounds like it would be a nice feature addition, I think. It could sort 2 byte numbers.

Also offtopic note about your signature, you really should make frequent backups (not just Axe backup feature, but copying the files on your computer) every 30 minutes during programming, so if your project gets hit by a memory clear, you don't lose most of your code.
« Last Edit: October 05, 2010, 02:09:29 pm by DJ Omnimaga »

Offline Aichi

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +76/-3
    • View Profile
    • Devrays
Re: how to make an appvar????
« Reply #10 on: October 05, 2010, 03:41:28 pm »
@ DJ

Yes, sorting word values would be a nice improvement.

-

My own laptop is broken at the moment and I cant be often on a PC (Most time online in wii browser, Omnimaga has some strange graphic bugs there by the way. :D). Im going write the lost part again and realease v0.1b here as soon as I can.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: how to make an appvar????
« Reply #11 on: October 05, 2010, 03:45:21 pm »
Ah I see x.x, well nothing I can do about Wii browsing since it means the browse is not up to web standards, then (like Opera and Firefox for Windows and maybe Chrome)