Author Topic: Using AppVars, more help!  (Read 7393 times)

0 Members and 1 Guest are viewing this topic.

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Using AppVars, more help!
« Reply #15 on: June 29, 2011, 11:07:02 pm »
wth..I'm so mixed up atm :P

What are you trying to do with this?
Vy'o'us pleorsdti thl'e gjaemue

Offline XVicarious

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +45/-28
  • I F**king Love Twisty Puzzles
    • View Profile
    • XVicarious
Re: Using AppVars, more help!
« Reply #16 on: June 29, 2011, 11:11:41 pm »
I'm trying to display each chapter (appv) that exists on the calculator. appvBLUTCH1, etc.  If it exists, draw a menu item for it. My problems are: the code just crashes, the menu items are drawn near the top of the screen, chapters that do exist are drawn on top of one another.

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Using AppVars, more help!
« Reply #17 on: June 29, 2011, 11:13:43 pm »
Hmm, maybe that can be done with a for loop, how many levels are planned?

0→C
10→Y .or whatever y-coordinate you want the top menu item to be at
"appvBLUTCH0"→Str1
For(A,1,3) .counting from 1 to 3 b/c there's 3 chapters
A+48→{Str1+8} .or 7, whichever the number is
.+48 because token value of 0 is 48, other numbers follow (1 is 49, etc), string is made of tokens
If Getcalc(Str1) .I think that'll work
Text(256*8,Y) .ask if you need but this defines coordinates, Y being Y and 8 for X...more optimized to pre-compute 8*256 btw this is just for simplicity
Text "Chapter ",A►Dec
.above 2 lines are the same as Text(Y,8,"Chapter ",A►Dec)
Y+8→Y .or whatever the gap from one option to another is
C++
End
End


This is assuming the fix and such is set.  After this C is the # of chapters, and you can do the other stuff accordingly.
« Last Edit: June 29, 2011, 11:32:03 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline XVicarious

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +45/-28
  • I F**king Love Twisty Puzzles
    • View Profile
    • XVicarious
Re: Using AppVars, more help!
« Reply #18 on: June 29, 2011, 11:19:04 pm »
Well I'm planning on supporting only three chapters, and maybe after I finish the game add support for more, but that really isn't an issue right now. I could write a loop for any amount of chapters I wanted. The issues that really need to be addressed right here though is the crashing is the biggest issue, and then after that the overlapping of menu items.

edit:
in the case people didn't see I edited the first post.
3) How do I get my Pic out of the appv and store it to Pic1? I have tried a variety of methods but none seem to work.
« Last Edit: June 29, 2011, 11:20:11 pm by jkag »

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Using AppVars, more help!
« Reply #19 on: June 29, 2011, 11:34:55 pm »
You mean the TIOS Pic1?  I think there's a command for that...
EDIT: i guess not..there's the option to absorb but not to store :P
« Last Edit: June 29, 2011, 11:37:20 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline XVicarious

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +45/-28
  • I F**king Love Twisty Puzzles
    • View Profile
    • XVicarious
Re: Using AppVars, more help!
« Reply #20 on: June 29, 2011, 11:42:17 pm »
I have tried methods, I can store the contents of an appv to like {A} as described in FinaleTI's tutorial and used his method, but I get two little dots.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Using AppVars, more help!
« Reply #21 on: June 29, 2011, 11:56:08 pm »
This should be working menu code. The code on the left should make sense. The code on the right should do the same thing as the code on the left while being about two-thirds of the compiled size, but probably won't make sense. They both rely on the appvars being in RAM, but you could probably modify this to successfully detect them if they are in archive as well.

I've also attached 8xp files for both of these so you don't have to retype all this code. The code blocks are just so you can see what the code looks like.


Code: (Sane Axe code) [Select]
..MENU

ClrDraw
Fix 1:Fix 5
Text(1,0→Y,"blut")
If sub(GET,1)
 Text(8,Y+10→Y,"Chap 1")
End
If sub(GET,2)
 Text(8,Y+10→Y,"Chap 2")
End
If sub(GET,3)
 Text(8,Y+10→Y,"Chap 3")
End
Text(8,Y+10→Y,"Help")
Text(8,Y+10→Y,"Quit")
Fix 0:Fix 4
DispGraph

FnOn
Repeat getKey(15)
 Stop  .Conserve batteries!
End
FnOff

.Input: Arg1 = File number to look up
Lbl GET
 Copy("appvBLUTCH1",L₁,9)  .Copy the name to L₁
 r₁+'0'→{L₁+7}  .Overwrite the last character
Return GetCalc(L₁)  .Find the appvar
   
   
Code: (Insane (optimized) Axe code) [Select]
..MENU

ClrDraw
Fix 1:Fix 5
Text(0*256+1)
Text "blut"
10*256+8sub(SMP)
⁻3
While 1
 +1→I
 If +3sub(GET)
  Copy("Chap "[],L₁+2,5)
  L₁+2sub(PMI)
 End
End!If I
"Help"sub(PMI)
"Quit"sub(PMI)
Fix 0:Fix 4
DispGraph

FnOn
While 1
 Stop  .Conserve batteries!
EndIf getKey(15)
FnOff

.Input: File number to look up
Lbl GET
 +'0'→{L₁+7}ʳ  .Write the number and terminator
 Copy("appvBLUTCH"[],L₁,7)  .Copy the name to L₁
Return GetCalc(L₁)  .Find the appvar

.Print Menu Item
Lbl PMI
 Text
 P+2560
.Set Menu Position
Lbl SMP
 Text(→P)
Return
   
« Last Edit: June 30, 2011, 12:09:58 am by Runer112 »

Offline XVicarious

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +45/-28
  • I F**king Love Twisty Puzzles
    • View Profile
    • XVicarious
Re: Using AppVars, more help!
« Reply #22 on: June 30, 2011, 12:14:09 am »
Thank you SOOO much Runer112. That Helped sooooo sooo much!
About my other question? Look either a couple posts up or the edit on the first post please.

edit:
Code: [Select]
.ROTT
GetCalc("appvROTTDATA")->A
ClrDraw
Pt-On(8,8,A)
DispGraph
Repeat getKey(15)
End
« Last Edit: June 30, 2011, 12:57:34 am by jkag »

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: Using AppVars, more help!
« Reply #23 on: June 30, 2011, 04:31:30 am »
If you want to copy the contents of an appvar to the TI-OS Pic1, you could do it with this one line of code.  However, I would do the checks that I'm ignoring to make sure the appvar exists and that there was enough ram to create the picture if it didn't already exist.

Code: [Select]
Copy(GetCalc("appvMYAPPV"),GetCalc("Pic1",768),768)
If you mean to copy it to the buffer for drawing over, then you would do this:

Code: [Select]
Copy(GetCalc("appvMYAPPV"),L6,768)
Since appvars could be located anywhere in RAM you cannot refer to them with static pointers such as Pic1, you would have to use variables instead.
___Axe_Parser___
Today the calculator, tomorrow the world!