KermMartian wrote:
Step 1: Formulate something that turns the sequence {76,66,56,46,36,26,75,...} into the sequence {1, 2, 3, 4...}. Take X as any given key value:

(1a) Notice that it's sets of 6, counting down from 6. int(.1X)) gives {7,6,5,4,3,2,7,...}. We want to count up, so let's try 7-int(.1X) to get {0,1,2,3,4,5,0,...}.

(1b) Now we need to use the ones digit. The first 6 are 6, the next 6 are 5, next 6 are 4, etc. First we need the digit itself, we'll use X-10int(.1X) to get it. This will give us {6,6,6,6,6,6,5,5,5,5,5,5...}.

(1c) We want {0,0,0,0,0,0,6,6,6,6,6,6,12,12,12,12...} as our offsets, so we'll do 6(6-(X-10int(.1X))) = 36-6X+60int(.1X).

(1d) Now we put {0..., 6...., 12,... } together with {0,1,2,3,4,5,0,1...} to get {0, 1, 2, 3, 4, 5, 6, 7, ... 25}:
7-int(.1X)+36-6X+60int(.1X)

(1e) Simplify! 43-6X+59int(.1X). And we need to offset from 1, not 0, so 44-6X+59int(.1X)

Step 2: Grab a letter!

Code:
StrMid "ABCDEFGHIJKLMNOPQRSTUVWXYZ",44-6X+59int(.1X),1


Step 3: Put it all together!


Code:
3->Dim List 10
Locate 1,1,"___"
For X=1 TO 3
0->K
While K=0
Getkey->K
WhileEnd
K->List 10[X]
Locate X,1,StrMid "ABCDEFGHIJKLMNOPQRSTUVWXYZ",44-6X+59int(.1K),1
ForEnd


Hopefully that makes sense!


Surprisingly, I approve of the number of commas in this post.
Also, very well thought out and well-explained solution.
Indeed KermM, well put. I was trying to figure out the For loops but I never would have explained it well enough nor gotten in this much smaller.
SirCmpwn, ComicIDIOT, many thanks, I hope Sarah finds it helpful. The only thing that I'm concerned about is having gotten the StrMid and For syntax correct, since I'm not yet a Casio BASIC syntax expert, but hopefully I guessed correctly. The only thing I'm really vague about is if Casio BASIC indexes strings from 0 or 1.
Nice, Kerm Smile I'm almost certain that string indices are from 1, since that's what the standard BASIC model uses. I also seem to recall seeing some code that grabs the first letter online, and it used 1.
_player1537 wrote:
Nice, Kerm Smile I'm almost certain that string indices are from 1, since that's what the standard BASIC model uses. I also seem to recall seeing some code that grabs the first letter online, and it used 1.
Excellent, that's more or less what I figured. I think we should probably start a Useful Casio BASIC Routines topic, if we don't already have one, since we're on the topic.
Well, that was pretty confusing, but if I work with it alot(The string thingies) I'm sure I could get them to work the way I want eventually.
Sarah wrote:
Well, that was pretty confusing, but if I work with it alot(The string thingies) I'm sure I could get them to work the way I want eventually.
Tell me which part was confusing so that I can clarify it for you!
KermMartian wrote:
Sarah wrote:
Well, that was pretty confusing, but if I work with it alot(The string thingies) I'm sure I could get them to work the way I want eventually.
Tell me which part was confusing so that I can clarify it for you!

Well basically, the whole way Str works >:

And unfortunately, all the letter keys aren't in a pattern. They're in a shape like this on the calculator

Code:
ABCDEF
GHIJKL
MNO
PQRST
UVWXY
Z


Keys in the same column have the same tens digit, keys in the same row have the same ones digit, and there's six columns for the first two rows of letters, five columns for the rest. There's really no pattern.
Oooh, I see that I missed the exceptions. I'm sure that a relatively concise single formula can be derived even with those irregularities then; if you don't have a chance to look for it, I'll try to do so myself later.
KermMartian wrote:
Oooh, I see that I missed the exceptions. I'm sure that a relatively concise single formula can be derived even with those irregularities then; if you don't have a chance to look for it, I'll try to do so myself later.

That would be great Smiling Cat
I'm busy working on my enemy conversion. Is there a way to easily recall the letters later, for like, NPC text?
Kerm, while I like that solution, you might have noticed that the BASIC keycodes are indexed from 28 (29?) starting from the right side of the keypad and skipping a number for some of the rows. Getkey-28 will get you something similar to {1,2,3,4,...} with only a few minor discrepancies. Personally, I just scramble use that and scramble the string appropriately Razz
Here, I modified an image with all of the codes.

Very nice, this should help in more ways than one.
comicIDIOT wrote:
Very nice, this should help in more ways than one.

I have the unmodified image if you ever need it, by the way.
I'm good for now. Although the white text on black is a bit hard to read, the pattern is easy enough to follow that I'm able to determine those codes.

I am unfortunately not smart enough to find a pattern among those ABC codes to help with your program Sad
comicIDIOT wrote:
I'm good for now. Although the white text on black is a bit hard to read, the pattern is easy enough to follow that I'm able to determine those codes.

I am unfortunately not smart enough to find a pattern among those ABC codes to help with your program Sad


The blacked out areas are areas I blacked out because you didn't need them. I guess I'll just post the unmodified image.

Yay for the extremely obvious abuse of the Fill tool Very Happy Joking aside, I think it would be fun to try to write a one- (or three-) liner that would do this. If I get time today, I'll try (though don't hold your breath :/).
I'm going to list all the current bugs with my RPG here, cause I probably shouldn't triple post in my other topic ;-;

-Stopping a program in some places results in ZRPG think you're starting a save. Starting it again solves the issue. Is there some way to run a line of code on pressing Ac/on?
-Not finishing the story battle results in ZRPG not resetting the map/location on restart, causing you to immediately open the treasure chest without the map opening even, no matter how many times you reopen ZRPG. Implemented a half fix that requires you to open ZNWGME and then open ZRPG.
-Upon finishing the story battle, you'll somehow end up on the map where you first entered it.
-Reading a sign and then trying to exit the current map will make you enter the same map on the opposite side. Trying to exit again after will work.
-I somehow broke random encounters after implementing the new battle system.
-You enter Map 8 in the wrong spot from the 3rd path.
-Some text cancels display incorrectly.

Code:
1->W
" "->Str 1
While W=1
Getkey->K
If K:Then
Int (K/10)->A
7-A+1->B
Locate 1,1,B
K-(A*10->C
Locate 1,2,C
B+6(C=5)+12(C=4)+15(C=3)+20(C=2)+25(C=1->D
Locate 1,3,D
Str 1+StrMid("ABCDEFGHIJKLMNOPQRSTUVWXYZ ",D,1->Str 1
Locate 1,4,Str 1
IfEnd
WhileEnd


I'm going to clean it up once my poor brain has some time to cool off. But get this typed into your calc and you have access with pressing a key and getting a letter. I need to go in and set up some conditionals to deal with hitting non-letter keys, and a way to escape (which is very easy to do). I'll probably release it as a whatever file type they are in :p


Edit:

http://www.cemetech.net/forum/viewtopic.php?p=162466#162466

Cleaned up a bit, there.
Ooooh, you figured out the pattern? I should note that you can optimize K-(A*10 into K-10A.
  
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