Author Topic: Axe Q&A  (Read 591722 times)

0 Members and 9 Guests are viewing this topic.

Offline selectcoaxial

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #525 on: July 24, 2011, 12:41:40 am »
I modified my post above.

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: Axe Q&A
« Reply #526 on: July 24, 2011, 12:52:12 am »
It probably isn't displaying the string because it crashes before it gets to the code to display the string.

EDIT: {Str1+2I-2} ?  That would make it work with two-byte numbers if you had the r.
Just for the record, two hex digits (ie [00]) make one byte, not two.

EDIT2: The code from before you edited it, meaning the code with {Str1+I-1}, works correctly.  What might have happened is it displayed the string and quit so fast you didn't see it?  Try putting a Pause 1900 at the end (pauses for about a second) and then see what happens.
« Last Edit: July 24, 2011, 01:02:52 am by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline selectcoaxial

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #527 on: July 24, 2011, 01:07:55 am »
The reason I edited to {Str1 + 2I - 2} was because each byte in the string with 16 letters represents a letter. So if I=1, position in the string (p) is 0; I=2, p=2, I=3, p=4 and so on. 2I-2 is the order of the 'th' in the string as 'I' increases.

I tried to put Pause 1900 at the end of the code and ran the program, the program paused for a while but still doesn't display anything.

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: Axe Q&A
« Reply #528 on: July 24, 2011, 01:16:36 am »
The code from before you edited it, meaning the code with {Str1+I-1}, works correctly.
That meaning, it displayed the string fine, and quit without a cinch.
Code: (What I'm using) [Select]
.ATEST
.[00000000000000000000000000000000]→Str1
Zeros(32)→Str1
.Zeros() does the same thing, but it's easier to code in in this case :P
.worked with initial bunch of 00s as well
"0123456789-+/*^,()"→Str0
For(I,0,15)
{rand^18+Str0}→{Str1+I}
.counting from zero is usually more efficient, in this case the -1 is omitted
End
ClrHome
Disp Str1
Repeat getKey(15)
.wait until clear is pressed
Pause 10
End
Worked without a problem for me.
« Last Edit: July 24, 2011, 01:30:15 am by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline selectcoaxial

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #529 on: July 24, 2011, 01:38:10 am »
Oh, I think I know what I've been doing wrong all along now. Thanks for your help!

Offline selectcoaxial

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #530 on: July 24, 2011, 01:55:52 am »
Is there a way for Axe to input user's numbers? I looked at the command list of axe and there's a 'input' command. Anyone know how to use it?

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: Axe Q&A
« Reply #531 on: July 24, 2011, 01:59:21 am »
Input is really buggy, personally I'd only use it as a last resort.  You'd probably be better off making your own input routine :P (or use one from the routines thread, such as this from the routines thread)
Vy'o'us pleorsdti thl'e gjaemue

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Axe Q&A
« Reply #532 on: July 24, 2011, 02:52:10 am »
The reason I edited to {Str1 + 2I - 2} was because each byte in the string with 16 letters represents a letter. So if I=1, position in the string (p) is 0; I=2, p=2, I=3, p=4 and so on. 2I-2 is the order of the 'th' in the string as 'I' increases.

I tried to put Pause 1900 at the end of the code and ran the program, the program paused for a while but still doesn't display anything.
You can't use implicit multiplication in Axe. The correct way to do it is {I*2+Str1-2}.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline selectcoaxial

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #533 on: July 24, 2011, 02:55:48 am »
thank you

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #534 on: July 24, 2011, 05:30:30 am »
Input is really buggy, personally I'd only use it as a last resort.  You'd probably be better off making your own input routine :P (or use one from the routines thread, such as this from the routines thread)

Yes, that's the only way to do it, even though I never managed to do it, even with the routines. I wish somebody posted an example :)

Offline selectcoaxial

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #535 on: July 24, 2011, 06:44:43 am »
In Axe example Axeguess, there are a few lines of code that confuses me.

1. While B-9→B>9:End, what is this for?
2. rand→B, this would make a random number all the way from 0 to 65000ish so how is this going to be contained within 0-9?
3. ReturnIf A 'not equal to' 0. why is the return here? isn't A not equal to 0 what the author wants?
4. Is there a way to display the user input number onto the screen at a specified coordinate and not as a text but something like Output( in TI-BASIC?

Code: [Select]
.GUESS
"GUESS THE NUMBERüStr1
"TOO HIGH!üStr1H
"TOO LOW!üStr1L
"YOU WIN!üStr1W
DiagnosticOff
Lbl MN
ClrHome
Disp Str1
rand→B
While B-9→B>9:End
Lbl M
sub(1)
If K=15
ClrHome
Return
End
If A>B
Disp Str1H,i
Goto M
End
If A<B
Disp Str1L,i
Goto M
End
Disp Str1W,i
Pause 2000
ClrHome
Return

Lbl 1
0→A
getKey→K
If K=36:7→AEnd
If K=35:4→AEnd
If K=34:1→AEnd
If K=28:8→AEnd
If K=27:5→AEnd
If K=26:2→AEnd
If K=20:9→AEnd
If K=19:6→AEnd
If K=18:3→AEnd
ReturnIf K=15
ReturnIf A not equal to 0
Goto 1

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Axe Q&A
« Reply #536 on: July 24, 2011, 07:44:27 am »
Your first two questions are the answers to each other. The "While B-9→B>9:End"  limits the number to 0-9. The "ReturnIf A not equal to 0" causes the program to go back to after the subroutine is called. I think you can use the Output( command in a way similar to basic, the command list will probably say.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #537 on: July 24, 2011, 08:06:06 am »
The "While B-9→B>9:End"  limits the number to 0-9.

Isn't it faster to just limit it with rand^X→B?

Offline selectcoaxial

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #538 on: July 24, 2011, 08:07:51 am »
I have no idea, this comes with the axe 0.5.3 package

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Axe Q&A
« Reply #539 on: July 24, 2011, 08:11:24 am »
Well, that is from the example code that selectcoaxial posted, which I asume he got from the examples included with Axe. It may just be outdated. On that topic, is the sub(1) still valid in Axe 1.0.1?