Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - meishe91

Pages: 1 2 [3] 4 5
31
TI-BASIC / Jump Code Explanation
« on: August 07, 2010, 01:23:04 am »
So I realized that it has been quite a while sine I've done one of these. So, for this one I decided to choose a topic that I really haven't ever seen discussed in tutorials or guides or anything. So here you have it, a code explanation about jumping :)

Without further adue, here is the code I will be working with.

Code: [Select]
ClrHome
8→X
1→Y
DelVar ARepeat 0
getKey→K
Output(X,Y,"_
Y+(K=26)-(K=24
Ans-16((Ans=17)-not(Ans→Y
X-A→X
A-2(X=5→A
If X=8
DelVar A
Output(X,Y,"π
A+(K=25 and X=8→A
rand(11
End

Note:
This is NOT the best example for jumping. It is more based for concept. If someone would provide me code that does the same thing as this program (in terms of looking the same) then I will happily disect that code too for everyone.

Ok, so I will just go line by line and do this and explain as I go. I will then create a commented set of code at the bottom that covers everything too.

Let's get started.

ClrHome: I'm assuming most of you know what this does. But for those who are very beginners this command clears the homescreen of everything that is on it. This is also the operating systems way of doing this. There are multiple ways of clearing the screen with code but this will be your fastest and most memory efficient way.

8→X and 1→Y: Again this is a fairly simple thing to know. But basically you are storing the integer (in this case anyways) into the variable. The command is used to store what ever is on the left side into what is on the right. So in these examples we are storing eight into the variable X and one into Y.
But the command isn't just used for integers and variables. You can store things such as strings (a set of characters) into a string (represented on the calculator as Str1, Str2, etc.). An example of this would be storing "HELLO WORLD!" into Str1. The code would look like:

Code: [Select]
"HELLO_WORLD!→Str1
But this still isn't all. You can store all sorts of things such as matricies, lists, dimetions, plus some other stuff. But that is all for a different guide ;)

DelVar ARepeat 0: This is actually two lines of code in one. It is split up into DelVar A and Repeat 0. First, the DelVar A part. What DelVar does is clear out a variable and stores zero into it or if it is used with a list or matrix or something it completely resets it. Now for the Repeat 0 part. Repeat is one of the three main looping commands. There is For(, While, and Repeat that all do different things (well sorta, they more just act differently). I will only explain Repeat for the sake of this break-down. What Repeat does is repeat a block of code until a certain condition is true. This means that the way this works is that you put a Boolean conditional as the argument. A Boolean conditional is statement that will either return true or false (one or zero, one being true and zero being false). This are often recognized by their use of =, , , >, , and <. Not always, but usually. So since Repeat repeats until true, and zero means false, this loop will loop indefinetly.

Tip:
If you ever use 0→A, or zero stored into any variable, then replace it with DelVar A, or what ever variable is used. It is much more memory efficient. Also, I forgot to mention that you can stack multiple DelVars in a row and before any other command or length of code. An example is:

Code: [Select]
1→A
Ans→B
Ans→C
Ans→D
Repeat 0
getKey
If Ans
DelVar ADelVar BC+D→A
End

When you break the code and see what A is it will equal two.

getKey→K: So the getKey command is a standard in games and is fairly simple. It is the command that detects key presses. Each key is assigned a different number. For the most part each row starts at a multiple of ten plus one number, so the first row starts with eleven. Then you just count outwards to the right until the end of the row then, instead of wrapping around, the next row starts with that first buttons key number on the line before plus ten. So row two, the row with [2ND], would start with twenty-one. A good way to find out which keys are which just use this program:

Code: [Select]
Repeat 0
getKey
If Ans
Disp Ans
End

Note:
All the keys have a number assigned EXCEPT for the [ON] button. In TI-BASIC that key will always break the code execution.

Output(X,Y,"_: Output( is yet another simple command. It simply outputs what ever is in the third argument on to the homescreen at point (Y,X). The y-coordinate, which is the first argument, can go from one to eight while the x-coordinate can be from one to sixteen. If you go beyond this you will get an ERR:DOMAIN error. However this does not restrict you to using only sixteen characters per line. When the output goes beyond column sixteen it will wrap down to the next line. Here is an example of this:

Code: [Select]
"*
For(A,1,7
Ans+Ans
End
Output(1,1,Ans

So the point of this line in particular is that it is puting a single space at where the future pi guy was, clearing that spot and erasing a trail. If you didn't have this you would leave a trail of pi characters each time you moved or jumped.

Y+(K=26)-(K=24: This is the start of where that Boolean logic I talked about comes into play. What we have here is the Y variable, which holds our x-coordinate of our character, being affected by which key is pressed (remember, we stored the value from getKey into K). If the the key pressed was the left arrow then K will be equal to twenty-four then the Boolean conditional (K=24) will equal one. This in turn subtracts one from Y. If you push the right arrow button then K will equal twenty-six and then add one to Y.

Ans-16((Ans=17)-not(Ans→Y: This line is basically a run on of the last line. It take the answer from it and will either subtract or add sixteen to that number if the number is seventeen (subtracts from) or zero (adds to) because both of these will result in a ERR:DOMAIN. If it doesn't equal either of those then it will just store what ever number was the answer to Y. So, basically, this line is the line that makes the pi character wrap around the screen if he goes off one end.

X-A→X: As talked about when explaining the Output( command, X is our y-coordinate. So since this is about jumping we need some type of variable that changes that affects when our guy jumps, that is the A variable. Basically though this is subtracting what ever value is in A from X to give the appearance of jumping.

A-2(X=5→A: Hey, look, another Boolean statement. What is happening here is that we are constantly storing A into A but if X equals five then it will subtract two from A and store negative one to A (the only way for X to equal five is if the guy is jumping and A will equal one at that point).

If X=8: our first If statement. It's pretty simple. If the statement is true, it will execute THE NEXT LINE, not just the next command. This is why on the next line that DelVar A is on a line of it's own instead of being DelVar AOutput(X,Y,"π.

DelVar A: As explained before DelVar just deletes what ever is in it's argument. In this case it is a variable so it sets the value to zero. This only happens though once X becomese eight again after a jump.

Output(X,Y,"π: This is pretty obvious now. It will output the Greek letter pi at the cooridnates (Y,X). This is what will be jumping too.

A+(K=25 and X=8→A: This is where our jumping initially starts. A will always be equal to zero unless the character is in the middle of a jump (then it will be equal to either one or negative one). If you push the up arrow key it will store a value of twenty-five to K  which meets the first part of this conditional. Then we need X to be equal to eight, which is when the character is on the ground. As long as both of those conditions are true then you will initiate a jump by storing one into A.

rand(11: This is basically here to slow this loop down. Without it here the loop will run to quickly for you to see what is happening during a jump. You can always fine tune this to what you like by messing with the number. But basically how this works is that the rand command creates a "random" number (I say "random" because technically a computer can't produce a truly random number). When you add the second argument of (11 then you are telling it to create an abitrary list of random numbers which takes a bit to create because calculating these random numbers takes time.

End: Woo, finally to the end. This just marks the end of our Repeat loop.

Commented code time:

Code: [Select]
ClrHome  \\Initially clears the homescreen of any junk previously on it.
8→X \\Stores the integer eight into the variable "X."
1→Y \\Stores the integer one into the variable  "Y."
DelVar ARepeat 0 \\Our double line. First it deletes the integer previously stored in variable "A" and replaces it with zero. Then it starts an indefinite loop.
getKey→K \\When you press a button it stores what ever value from the key you pressed into the variable "K."
Output(X,Y,"_ \\Outputs a single space at the coordinates (Y,X) to erase the trail that would be left behind.
Y+(K=26)-(K=24 \\This controls the movement left and right. If the left arrow is pressed then twenty-four is stored to "K" and subtracts one from "Y."
Ans-16((Ans=17)-not(Ans→Y \\Takes the answer from the previos line and either stores it as is, subtracts sixteen if the answer was seventeen or adds sixteen if the answer was zero.
X-A→X \\Applies our "jumping" variable to the variable "X."
A-2(X=5→A \\When our character reaches three spaces up in the jump it will subtract two from "A" to make the guy go back down.
If X=8 \\If the value of "X" equals eight then it will execute the next line.
DelVar A \\Deletes the integer stored to "A" and replaces it with zero if the value in "X" equals eight.
Output(X,Y,"π \\Outputs our character, the Greek letter pi, at the coordinates (Y,X).
A+(K=25 and X=8→A \\Adds one to the "A" variable if the up button is pressed the guy is on the floor. This initiates the jump.
rand(11 \\Effectively slows down our loop enough to let us see what is happening with the jump. Creates an abitrary list of eleven random numbers.
End \\Marks the end of our Repeat loop.

Ok, we have reached the end. Hopefully you have learned something. Again, this is a poor example of jumping code and there are much better examples out there. If someone provides me with a set of code that does this same thing but is much better I will happily explain it and do a code breakdown for it.

Thanks:
ztrumpet and nemo: For helping me with the concepts of creating simple jumping code. Thanks guys :)

I really hope this has been helpful and enjoy :)

32
ASM / Assembly Noob Question
« on: July 29, 2010, 09:15:13 am »
Ok, so I started to read Hot_Dog's tutorials and just have a noobish optimization question. It doesn't matter either way really but I just wanna know if I am technically correct or not.

One of the sample programs shows this, or something close:

Code: [Select]
#include "ti83plus.inc"
.org 40339
.db t2ByteTok,tAsmCmp

 B_CALL _ClrLCDFull

 ld b,200
 ld a,5

Beginning_Of_Loop:

 add a,1

 djnz Beginning_Of_Loop

 ld h,0
 ld l,a

 B_CALL _DispHL
 B_CALL _getKey
 B_CALL _ClrLCDFull

 ret

Wouldn't it technically be better to do:

Code: [Select]
#include "ti83plus.inc"
.org 40339
.db t2ByteTok,tAsmCmp

 B_CALL _ClrLCDFull

 ld b,200
 ld a,5

Beginning_Of_Loop:

 inc a

 djnz Beginning_Of_Loop

 ld h,0
 ld l,a

 B_CALL _DispHL
 B_CALL _getKey
 B_CALL _ClrLCDFull

 ret

I have no idea if that even does the same thing, I didn't test it. I'm just doing this off what I see.

Sorry if this sounds dumb, but I'm just a little curious. Thanks for any help :)

33
Miscellaneous / I need your guy's opinion, for real this time.
« on: July 26, 2010, 11:48:01 pm »
So many of you know about my Programming Tutorials, Help, Etc. thread in the Miscellaneous Discussion board. I'm thinking about redoing some of the organization and what is there and such and I want your guy's opinion on what goes into the calculator section. Currently I have it kind of restricted to lesser known documentations and such along with the things Omnimaga users create. What I need to know is if you guys want me to include just anything that is useful or that I think will be useful, keep it how it is, or add in the more famous documents and such. To me it doesn't bother me either way, I made the thread for you guys to help everyone out so that is why I'm asking :)

If you guys have another option that you think could be added post it and I'll think about putting it on the poll. You can also change your vote if you'd like. I would really like it if as many people could vote as possible :)

34
Miscellaneous / Programming Languages
« on: July 26, 2010, 10:49:02 pm »
So I've been a little curious about this for a while now. What programming languages does everyone know? How skilled are you at them? (Like beginner, intermediate, advanced.)

I shall start:
TI-BASIC: Beginner-Intermediate
Axe: Beginner

Also, for the more experienced people. Which language would you suggest people learn first or start out with? Any resources or advice?

35
TI Z80 / Battle Ship
« on: July 26, 2010, 02:50:30 am »
Ok. So I decided to completely do a rewrite of my Battle Ship program because I thought it was to big and just wasn't satisfied with it. I was also to lazy to just go back and rework the code to work. But anywho, to the program.

I did succeed in making this one smaller by about 62 bytes while still making it better than the previous version (it stands at 990 bytes). It should work perfectly now but if anyone discovers a bug please let me know.

[2ND] - It is the enter button.
[ALPHA] - When setting the maps this is what flips it between vertical and horizontal movement.
[ENTER] - Used to exit the Pause after turns.

This version fixes the previous bugs that I knew about. Like I said before if you find one just tell me and I'll try to fix it.

I can't think of much else to say so I'll let you guys to it. Have fun and enjoy.

Here is the source code in case anyone else can find optimizations. I'm very tired so there is a chance I missed something.

Code: (Battle Ship Final) [Select]
ClrHome
"3221110000→Str2
"MH  →Str1
0identity(16→[A]
DelVar TDelVar SDelVar LRepeat S=20 and T=20
ClrHome
For(A,1,8
Output(A,9-8L,"++++++++
End
Output(1,9-8L,"PLAYER
Output(1,16-8L,L+1
1→X
1→Y
DelVar G1→R
Repeat R=11
Repeat K=21
For(A,0,expr(sub(Str2,R,1
Output(X+AG,Y+Anot(G)+8L,sub("* ",2-[A](X+AG,Y+Anot(G)+8L),1
End
If Ans=31
not(G→G
min(8-Gexpr(sub(Str2,R,1)),max(1,X+sum(DeltaList(K={25,34→X
min(8-not(G)expr(sub(Str2,R,1)),max(1,Y+sum(DeltaList(K={24,26→Y
For(A,0,expr(sub(Str2,R,1
Output(X+AG,Y+Anot(G)+8L,"*
End
Repeat Ans
getKey→K
End
End
DelVar HFor(A,0,expr(sub(Str2,R,1
H+[A](X+AG,Y+Anot(G)+8L→H
End
If not(H
Then
For(A,0,expr(sub(Str2,R,1
1→[A](X+AG,Y+Anot(G)+8L
End
If L
T+1+expr(sub(Str2,R,1→T
If not(L
S+1+expr(sub(Str2,R,1→S
R+1→R
End
End
not(L→L
End
1→X
Ans→Y
randInt(0,1→L
Lbl 1
Repeat S=0 xor T=0
ClrHome
For(A,1,8
Output(A,1+8L,"++++++++
End
Output(1,1+8L,"PLAYER
Output(1,8+8L,L+1
For(A,1,8
For(B,9-8L,16-8L
Output(A,B,sub(Str1,4-[A](A,B),1
End
End
1→X
9→Y
Repeat K=21
Output(X,Y-8L,sub(Str1,4-[A](X,Y-8L),1
min(8,max(1,X+sum(DeltaList(K={25,34→X
min(16,max(9,Y+sum(DeltaList(K={24,26→Y
Output(X,Y-8L,"S
Output(3,4+8L,sub("ABCDEFGH",X,1
Output(3,5+8L,Y-8
Repeat Ans
getKey→K
End
End
If 1<[A](X,Y-8L
Then
Output(5,1+8L,"TRY
Output(6,4+8L,"AGAIN
Pause
Goto 1
End
If not([A](X,Y-8L
Then
Output(5,3+8L,"MISS
3→[A](X,Y-8L
not(L→L
Pause
Goto 1
End
If 1=[A](X,Y-8L
Then
Output(5,3+8L,"HIT!
If L
T-1→T
If not(L
S-1→S
2→[A](X,Y-8L
not(L→L
Pause
End
End
End
DelVar [A]ClrHome
not(L→L
Output(4,5,"PLAYER
Output(4,12,L+1
Output(5,7,"WON!

36
Miscellaneous / I'm Back
« on: July 07, 2010, 04:24:13 am »
Ok, I know I'm WAY overdue for updating this top thread and I'm very sorry for that. I'm also very sorry for being gone a lot longer than I anticipated. I have just been dealing with a lot of personal stuff lately and its just been overwhelming. I have a lot of catching up to do on here, and I mean A LOT, so don't be surprised if I'm behind in news and ask "dumb" questions.

Ok, for my summary of my trip I will be copying straight from my Facebook, so I don't have to retype it all and such, so it will probably seem a bit off since it was meant directly for the people I know in person. Anyways, here it is.

"Ok, so quite a few people have asked about my trip to Europe and before I really wanted to start answering questions I thought I would write this to save some time of getting asked the same ones over and over and such. So let’s start at the beginning.

I woke up and went to DIA and flew from there to Atlanta where we then had a six hour layover. That get’s really boring. But from there we flew to London, which was about a nine hour flight, where we basically immediately boarded the coaches and drove to Windsor Castle. The queen was there, because the Union flag was raised, but we didn’t see her. We walked around outside of the castle, took pictures, and went to souvenir shops. Before we got back on the coaches I got my first set of fish and chips in England. The fish was good but the chips could have been better. (Alexis and Rachel also almost stole a bag of potato chips :P) We all got back on the coaches and went to the hotel and then had dinner. After that we had a little free time but then went on a big walk a short distance away from the hotel to across the Millennium Bridge (the bridge the Death Eaters terrorize in The Half-Blood Prince movie in the beginning). We pasted some big cathedral that was being restored, don’t remember which one. The next couple of days we went to the London Tower, saw the changing of the guards at Buckingham Palace, went on the London Eye (at least some of us), performed, and saw the musicals if we bought tickets. I saw The Lion King, which I was actually quite disappointed in. The costumes, effects, and instrumental music were good but I was disappointed with the acting/singing. Just wasn’t that great, I thought.

We then were off to France. We drove for a couple hours, then crossed the English Channel (I think that’s which one it was) then drove a few more hours to Paris. We went to dinner first then went to the hotel, had orientation, and that’s about it. The next day we went to this alley place that led up to some cathedral and then we basically had free time until we had to leave that place. After that I’m pretty sure we just went sightseeing with a guide, ate dinner, and then went on a little boat ride seeing sights. Next day we went to the Eiffel Tower, the Louvre Museum, and preformed. All very cool things just didn’t have enough time in the Louvre really.

We left Paris for Crans-Montana, Switzerland. If you ask anyone who went on this trip (and was awake) they would tell you the sights were AMAZING. The mountains there are just really amazing. That night be basically ate dinner and then had a little free time. So a bunch of us went to the nearby lake and then found a playground to play on. Fun night. Next day was awesome too. We basically had the whole morning off so a group of us took a ride up to the top of a mountain. Very beautiful view up there. We then all got some lunch, some of the best pizza ever. We then all went to some castle there in Switzerland, walked a mile or two (probably an exaggeration) and got some ice cream. Headed back to Crans-Montana, ate dinner. Next morning we all went to Zermatt where we had the chance to get well priced Swiss Army Knives and see the Matterhorn. Unfortunately some stupid cloud kept on teasing us and wouldn’t move out of the way really. Next day we left for Austria.

So on our way to Austria we pasted through Lichtenstein. It was literally about a fifteen minute drive in, wait 45 minutes to get lunch or something, then a fifteen minute drive out and off to Austria. A few of us went into a Rolex store…HOLY CRAP! A phone there was over 12,000 euro. Cheapest thing I saw was still like 300 euro. So we got to Seefeld, Austria. Ate dinner there and had a little free time. We found a playground and somehow I broke my camera’s LCD screen without knowing it. Next day we went to Innsbruck, went to the crystal palace place thing there, got some food and we went back to Seefeld. Had our concert, then dinner, then a little free time. Or something like that. The next day we woke up really early and drove down to Venice, Italy. First time I had slept since the first day we arrived in London. It was very hot and humid in Venice, about the equivalent to working behind the plate for six hours straight in dead heat (umpire reference). We went to a Venetian glass place, which was really cool, and then we heard the choir sing in St. Mark’s Basilica (I believe) which was also really cool. Found a Ferrari store there, way over priced :P Went back to Seefeld, packed, and left for Rothenberg in the morning.

On the way to Rothenberg we stopped at Dachau, a concentration camp for those who don’t know. That was very sad and depressing. It’s a very chilling feeling when you’re there…it’s hard to describe. It is definitely hard to be there. But after that we finished our way over to Rothenberg and had orientation, ate dinner, then had a little free time till bed checks. Next day was basically a free day for everyone. We had the whole morning off, then just concerts, then the rest of the day. That was fun. After that everyone had the pleasure of waking up super early (or just staying up in some cases) to leave for Frankfurt to fly out to where ever. I went back to Atlanta, where we had another layover but this one was only about four hours. Then got back to DIA and went home after waiting there for like two hours for instruments which we ended up having sent to us anyways…

Anywho, that’s about it. I know this isn’t super detailed but oh well, it’s a basic outline of what happened and such. I’m also sure I mixed a few things up or left a couple days out but oh well, you’ll have to deal :P

I also know this isn't written the best but oh well. I don't care much right now haha."

Again, I apologize for my absence and hopefully you all can forgive me.

37
Miscellaneous / Where Did Your Name Come From?
« on: June 17, 2010, 02:14:13 am »
Ok, so for a while now I've been curious about peoples names. I'm not talking about your real name, I'm talking about your name on here (like mine is "Meishe91"). No one is forced to share or anything, I just thought it would be cool to see how some people came up with their names, developed them, changed them, or got given them. Who knows. Everyone's may be different. Could be a favorite thing, an interesting story, a "I have no idea how I got this name, actually..." thing, or anything else.

I shall start:
So it all started over 6 years ago or so, I think. I'm not entirely sure how long. But I had just started to get back into RuneScape and I couldn't think of a name. One of my friends had the name of He_is_me0 (I believe there was a "0" at the end anyways, not relevant though :P) so I kind of just reversed it to be Me_is_he (which is still my RuneScape name still, not on as much now though :(). This was my tag for a lot of things for a quite awhile until one day I stumbled upon a site (I don't remember which) that didn't let me use underscores (the "_") so it got shortened to Meishe. Then I got to another site that made me have numbers and letters, for what ever reason, so I just added the 91 since '91 is the year I was born in. So now I have the tag Meishe91. Yup, not that interesting of a story but ya know, it works :P

38
Other / Anyone Else Have a HD2?
« on: June 06, 2010, 01:02:12 am »
Basically what the title says.

I'm just curious if anyone else on here has a HTC Leo/HD2/Touch Pro HD2 phone (T-Mobile (like I have) or the International version). I'm curious if anyone who does have this phone can point me in directions to where I can get good information about it. I've already discovered XDA-Developers and a couple other places. Also, just curious, if you have one, what you think about the phone?

P.S. Feel free to move this to Randomness if you wish, I wasn't sure if I should post it there or here.

39
Art / Suit Sprites
« on: June 05, 2010, 02:45:59 am »
Would anyone mind making 8*8 black and white sprites for the four suites of a deck of cards? (Hearts ♥, Diamonds ♦, Clubs ♣, and Spades ♠)
Thanks anyone :)

40
TI-BASIC / Extra Characters Reordered
« on: May 24, 2010, 03:49:23 pm »
So everyone knows the XTRACHAR.8xp program (or at least I'm assuming) that has the 208 character tokens. Well the order of it was starting to really bug me so I reordered them into a more neat and organized way, that I think makes more sense. It's not a big deal or anything but I thought I would share it with you all in case you wanted the new order or something, I don't know. Anywho, here it is.

Oh ya, the basic order is this: alphabet, numbers, subscript numbers, superscript tokens, accented letters and Greek alphabet, then the miscellaneous characters and symbols.

41
TI-BASIC / What Displays Faster?
« on: May 24, 2010, 02:57:02 am »
What displays faster when displaying something? The graph or homescreen? Or does it all depend on the code and circumstances? Just a little curious.

42
Other Calculators / 16-Level Grayscale
« on: May 18, 2010, 12:20:33 am »
Has anyone else ever seen, or heard, of 16-level grayscale for the 84+ before? I had never seen, nor heard it was possible, before I saw this program on ticalc by Brian Coventry. I don't know if he is someone from here already or not but he seems to be good at assembly, as a side note. Anywho, was just curious if someone else has seen this or seen something like this before.

43
General Discussion / How Do You Create Music?
« on: May 16, 2010, 07:28:12 pm »
Basically what the topic says. How do you guys create the music you show us? Do you know music theory, do you just slap stuff together until it sounds good, a combo, or something else entirely? I'm pretty curious.

44
Other Calculators / Sprite Sizes
« on: May 04, 2010, 01:09:18 am »
What sized sprites does everyone use? Like for any type of game or anything. The only ones I can think of are 7*7, 8*8, 16*16, and 32*32 but I'm assuming there are more that people use. Thanks :)

45
TI-BASIC / Hex with Sprites
« on: May 02, 2010, 05:57:23 pm »
Hello All,

Could someone please explain how hex works with creating sprites and all that? All I really know is that [FFFFFFFFFFFFFFFF] creates a solid 8*8 block while [0000000000000000] leaves a blank 8*8 area. Any help is very appreciated :)

Pages: 1 2 [3] 4 5