Ah, thanks. I completely forgot about that part. I was thinking in terms of
Code:
"Abc"
which won't terminate it with 0. Editing my post.
Hmm, now I learned something about Axe. Thanks for the lesson, guys. Smile
Well, I found a different way of doing it, but still thanks to you:


Code:
If getKey(3)
104->{Str4+1}
114->{Str4+3}
100->{Str4+4}
End

If getKey(2)
101->{Str4+1}
115->{Str4+3}
121->{Str4+4}
End


For optimization, The second letter ('A') isn't changed since it is equal for easy and hard.

Now, my problem is to check if a String is X.

For example,


Code:
If Str4="<Easy>"
//CODE
End


Unlike in most programming languages, this can't be done. it seems that I have to use pointers, but someone already said how to do it in this topic, need to check that out better.
You can't do that in any programming language. It's just the compiler or interpreter hiding the fact that it compares the two strings character by character. Almost every language, including TI-BASIC, C and ASM, uses a routine like the following to compare strings:


Code:
Strings S,T;
Indices I
While S[I] != \0 and T[I] != \0
If S[I] != T[I]
Return False
I<-I+1
End
Return True
I meant, PC programming languages:


Code:
a = raw_input("Enter the word \'Kill\': ")
#This comparison works
if a == "kill":
   print "You entered correct word!"
else:
   print "You didn't enter correct word!"
raw_input()


I have e-mailed Quigibo for help :S
Under the hood, the PC programming languages still do exactly the same thing that I wrote. They just hide it from you.
Does this not work?

http://www.cemetech.net/forum/viewtopic.php?p=127883#127883
_player1537 wrote:


I'm afraid I'm not comfortable with pointers. That's why I tended to avoid that.

When you say that r1 and r2, for example, are pointers to first string and second string. I can't define them.

Is it:


Code:

GetCalc(Str1)->r1
GetCalc(Str2)->r2


/me wonders
r1-r6 are the polar equation variables. They are a way to supply commands to your subroutines. Such as, to call my CS routine, you could do:
Code:
"ABC123->Str1
"123ABC->Str2
If Sub(CS,Str1,Str2)
Disp "THE SAME STRINGS"
Else
Disp "DIFFERENT STRINGS"
End


r1-r6 are just like variables except that normal code shouldn't touch them, so you should be safe using them as For() loop variables and such, and not have to worry about setting aside variables A-Theta for them. They also have the advantage of being able to be stacked, such as, you can have one routine call itself a few times, and it will save the previous values of r1-r6. Does that help any?

Code:

"Easy"->Str1
"Easy"->Str2

If Sub(CS,Str1,Str2)
//CODE FOR EASY GAME
Else
//CODE FOR HARD GAME
End
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


You mean this?
Yes, assuming you are changing Str1 or Str2 accordingly. Also, I believe you could even shorten it to this:
Code:
If Sub(CS,"Easy",Str2)
and it _should_ work from what I've seen of Axe.

Code:
"Easy"->Str1
"Easy"->Str2

If Sub(CS,Str1,Str2)
//CODE FOR EASY GAME
Else
//CODE FOR HARD GAME
End
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


The '==' signs should be just one '=', right?
Scout, yes. Most other languages use two equal signs to signify comparing instead of storing one value to another.
_player1537 wrote:
Scout, yes. Most other languages use two equal signs to signify comparing instead of storing one value to another.


I am aware of that -.-'


Now, Return in Axe closes the program, are the Returns really supposed to be there?
Yes. When you use subroutines, you have to use a Return to get the program flow back.
_player1537 wrote:
Yes. When you use subroutines, you have to use a Return to get the program flow back.


Just cos the program always closes when I use sub(CS)
Ah, that was one thing I forgot to mention (whether it applies, idk). You need to use a Return before the Lbl CS, or else it will try and run the code at CS again.
My error:

Sub instead of sub XD

IT WORKED!!!

Now, I need to change picture variable's conent, how to do it?

Thanks
Depends how you want to do it Smile Do you want to invert the entire picture? Rotate it? Paste a new sprite over it? Put different text on it? There are a lot of ways to do so. It all goes back to just having a large picture and using your curly brackets {} to access and edit memory.
Well, I didn't need it afterall.

All the difficulties are finished. I just need to figure out HighScore system with AppVars
  
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 2 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