Hello everybody,

Let's say I have this code:


Code:

"Easy"->Str1
Text(0,0,Str1
Repeat getKey->Z
End
If Z=3
. Make Str1 be "HARD"
End


How do I change a variable's content?

Also, in the future I will be using If getKey(X) = 3. Thanks much Very Happy

Code:
"Easy->Str1
Text(0,0,Str1
Repeat getKey->Z
End
If Z=3
"HARD->Str1
End
In Axe or BASIC?

Basic:

Code:

"HARD"->Str1

Axe:

Code:

72->{Str1+0}
65->{Str1+1}
82->{Str1+2}
68->{Str1+3}
merthsoft wrote:

Code:
"Easy->Str1
Text(0,0,Str1
Repeat getKey->Z
End
If Z=3
"HARD->Str1
End



in Axe that won't work ....


Code:
72->{Str1+0}
65->{Str1+1}
82->{Str1+2}
68->{Str1+3}


I've been told how to do this before, I don't understand that, but if i remember well you need to add 0s to the variable, add bytes so that it can be changed.

Maybe that'll remind of you something.

If your code is correct, I don't understand it :S
ScoutDavid wrote:
Hello everybody,

Let's say I have this code:


Code:

"Easy"->Str1
Text(0,0,Str1
Repeat getKey->Z
End
If Z=3
. Make Str1 be "HARD"
End


How do I change a variable's content?

Also, in the future I will be using If getKey(X) = 3. Thanks much Very Happy


You might try

Code:
Repeat K =not 0
getKey→K
End
If K=94
Then
"HARD"→Str1
End

If there's a better way for the getKey let me know. I haven't been able to actually get something out of than unless trapping into an infinite loop which you get out as soon as you hit a button. The prgm will only store "HARD" into the string if you hit the '3' button known by the calc as being 94[/code]
Again, AXE, not TI-Basic.

Code:
Repeat K =not 0
getKey→K
End
If K=94
Then
"HARD"→Str1
End


I believe that this is not Axe.

Come on, this is in Axe Parser subforum xD
ScoutDavid wrote:

Code:
Repeat K =not 0
getKey→K
End
If K=94
Then
"HARD"→Str1
End


I believe that this is not Axe.

Come on, this is in Axe Parser subforum xD


My bad thought it was basic
ScoutDavid wrote:
merthsoft wrote:

Code:
"Easy->Str1
Text(0,0,Str1
Repeat getKey->Z
End
If Z=3
"HARD->Str1
End



in Axe that won't work ....


Code:
72->{Str1+0}
65->{Str1+1}
82->{Str1+2}
68->{Str1+3}


I've been told how to do this before, I don't understand that, but if i remember well you need to add 0s to the variable, add bytes so that it can be changed.

Maybe that'll remind of you something.

If your code is correct, I don't understand it :S


The numbers I put in the code are the ASCII values of the string "HARD". You don't have to add an extra zero or anything because the length of the string 'Easy" is the same as the length of the string "HARD". Wink
Yes, in basic it's very easy, just:


Code:

"This is A"->A
"This is still A"->A
"This is a new A"->A
"This is the final A"->A
Disp A


souvik1997 wrote:
ScoutDavid wrote:
merthsoft wrote:

Code:
"Easy->Str1
Text(0,0,Str1
Repeat getKey->Z
End
If Z=3
"HARD->Str1
End



in Axe that won't work ....


Code:
72->{Str1+0}
65->{Str1+1}
82->{Str1+2}
68->{Str1+3}


I've been told how to do this before, I don't understand that, but if i remember well you need to add 0s to the variable, add bytes so that it can be changed.

Maybe that'll remind of you something.

If your code is correct, I don't understand it :S


The numbers I put in the code are the ASCII values of the string "HARD". You don't have to add an extra zero or anything because the length of the string 'Easy" is the same as the length of the string "HARD". Wink



Code:
%68%61%72%64


This is 'hard' in HEX, so huM? Maybe I'm wrong, I'll try that Smile


That worked!!!! Now, for easy, gotta find the ASCII values for 'EASY'


I found them, but I get the following error:

Code:

If Str4="Easy"
// CODE
End


I get Bad Symbol Error :S
Here is a simple Axe program to convert a string in Ans to its corresponding ASCII values:


.ASCII
GetCalc(Data(4,TAns,0,0))->A
0->X
Repeat {X+A}=0
Disp {X+A}>Dec,i ; This is the complex i
X+1->X
End
Repeat getKey
End
I think the problem is that ScoutDavid is having difficulties with hex; we unfortunately encountered this in his tokenizer topic as well.
KermMartian wrote:
I think the problem is that ScoutDavid is having difficulties with hex; we unfortunately encountered this in his tokenizer topic as well.


HEX you mean Hexadecimal or HEX the prorgamming language?

Also, KermM, I'm afraid to tell you that you are mistaken and making an unfair judgement.


Code:

72->{Str4+0}
65->{Str4+1}
82->{Str4+2}
68->{Str4+3}
Else
69->{Str4+0}
65->{Str4+1}
83->{Str4+2}
89->{Str4+3}


My problem right now is the getKey system...
You know, there is a chart included in the Axe zip that shows the key codes for the Axe getKey Smile.

Quote:
HEX you mean Hexadecimal or HEX the prorgamming language?


There is no HEX the prgramming language. There is machine code, however, which is compiled ASM.
Hex means hexadecimal. There is no programming language called hex. Hexadecimal is a way of representing any integers, including the numbers that make up the opcodes for machine code that is represented by assembly.
souvik1997 wrote:
You know, there is a chart included in the Axe zip that shows the key codes for the Axe getKey Smile.

Quote:
HEX you mean Hexadecimal or HEX the prorgamming language?


There is no HEX the prgramming language. There is machine code, however, which is compiled ASM.


Yes, HEX is not a programming language.


Try 1:

Code:
Repeat getKey->theta
End

If theta=3
If Str4=Str6
72->{Str4+0}
65->{Str4+1}
82->{Str4+2}
68->{Str4+3}
Else
69->{Str4+0}
65->{Str4+1}
83->{Str4+2}
89->{Str4+3}
End
Goto 1
End

If theta=2
If Str4=Str6
72->{Str4+0}
65->{Str4+1}
82->{Str4+2}
68->{Str4+3}
Else
69->{Str4+0}
65->{Str4+1}
83->{Str4+2}
89->{Str4+3}
End
Goto 1
End


Try2:

Code:
If getKey(3) or getKey(2)
If Str4=Str6
72->{Str4+0}
65->{Str4+1}
82->{Str4+2}
68->{Str4+3}
Else
69->{Str4+0}
65->{Str4+1}
83->{Str4+2}
89->{Str4+3}
End
End



Also, Str6 is 'EASY'.

I tried a few derivates from these too with no luck.
You change the huge stacks of storing to Str1 with this:

Code:
Copy(Data(<ASCII values>,0),Str1,<length of string>)
ScoutDavid wrote:
merthsoft wrote:

Code:
"Easy->Str1
Text(0,0,Str1
Repeat getKey->Z
End
If Z=3
"HARD->Str1
End



in Axe that won't work ....
Oh, oops. I failed to look at which forum this was in. My bad, sorry about that.
Let's see how my Axe level of expertise is...

Compare a string to another:
Code:
Lbl CS
.r1 pointer to first string
.r2 pointer to second string
.r3-r6 temp variable
.Ans is the return place

0->r3
Repeat {r2+r3}->r4 != {r1+r3} or ({r1+r3}->r5 == 0) or (r4 == 0)
::r3+1->r3
End
If r4 or r5 == 0
::1
::Return
End
0
Return


Store one string to another:

Code:
"String to replace with"->Str1
Copy(Str1,Str2,Length(Str1
(Should work...)
I don't think you need the [00], Axe automatically zero-terminates the data.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 3
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement