Here is a basic start to what will eventually be a full text sprite generator for an inputed string and a designated number. It is far from completed.

Code:

:ClrHome
:Input Str9 //or any string you want to change it to
:ClrHome
:ClrDraw
:DispGraph
:length(Str9→L
:For(X,1,L
:Text(0,X,sub(Str9,X,1
:Text(0,L+1,"
:End
:Return

Any help and suggestion are welcome, and I will have credits on here when it is 100% done.
1) Well, you don't want to store to Str9 on line 6, then
2) Before Input Str9, ask the user for three things:
2a) Number of sprites
2b) Number of rows per sprite
2c) Number of columns per sprite
3) Assuming the normal types of text sprites, you'll need the user to enter [2a]*[2b-5]*2c characters. If in the Input Str9 segment, they don't, make them re-enter Str9. Also of course tell them above the Str9 input how many characters they should be entering.

I'm sure I'll think of more later.
I will work on all of that, though as I said this is a work in progress, and it could take a while for a final version.
Sonlen wrote:
I will work on all of that, though as I said this is a work in progress, and it could take a while for a final version.
Definitely, certainly understandable. I just wanted to make sure I jotted those down, since I thought of them while staring at your code. Smile
KermMartian wrote:
Sonlen wrote:
I will work on all of that, though as I said this is a work in progress, and it could take a while for a final version.
Definitely, certainly understandable. I just wanted to make sure I jotted those down, since I thought of them while staring at your code. Smile

And that's what I like, even if I have already considered or figured something out, feedback is always nice, unless it's trolling. >.<
And while I am thinking about it, could you give me a refresher on Vertical Text Spriting?
Sure thing. This'll be somewhat complex for you to implement, but I tihnk you're up to the challenge. Basically, for pure vertical spriting (ie, not combined vertical and hybrid spriting), you first draw a character, then move up one or more spaces, then draw another character, and repeat. You may then erase the top of the final character, let it stay, or draw begin drawing the sprite above that sprite, which will be default erase its unwanted top. That's only cursory detail, though; what specifically would you like to know?
Well mainly what in the drawing code for horizontal sprites would need to be changed to go vertical, if I can get that I think I will be good for a little while longer.
Also I was wondering about I guess they could be called answer lists. I have seen codes for example:

Code:

:If Ans={24,26,25,34
:Then (Commands)

How does that work exactly?
That should probably be

Code:
If max(Ans={24,26,25,34
Then
"Insert Commands here
End

Note the added "max(" Smile
It performs and equality check for every element of the list.
So if Ans were 26, the statement in the If would evaluate to max({0,1,0,0 which simplifies to 1, or true.
It's pretty much shorthand for

Code:
If Ans=24 or Ans=26 or Ans=25 or Ans=34

Though for this specific example, you can get even smaller with abs( Very Happy

Code:
If Ans=34 or 1>=abs(Ans-25
calcdude84se wrote:
That should probably be

Code:
If max(Ans={24,26,25,34
Then
"Insert Commands here
End

Note the added "max(" Smile
It performs and equality check for every element of the list.
So if Ans were 26, the statement in the If would evaluate to max({0,1,0,0 which simplifies to 1, or true.
It's pretty much shorthand for

Code:
If Ans=24 or Ans=26 or Ans=25 or Ans=34

Though for this specific example, you can get even smaller with abs( Very Happy

Code:
If Ans=34 or 1>=abs(Ans-25

I have 1 question about that though, how would I get it to do different commands depending on which button was pressed, like if i had all 4 of the buttons set up to something?
You'd have separate ones inside that for if Ans=24 or if Ans=25, etc.
If each button does nothing in common with the other, though, or you can't generalize the inside of the If Then block, then you're probably better off just having them entirely separate.
(By generalize, I mean, for example, the 1st or 2nd block instead of the 3rd)

Code:
If 1=abs(Ans-25
X+Ans-25->X


Code:
X+(Ans=26)-(Ans=24)->X


Code:
If Ans=24
Then
X-1->X
Else
If Ans=26
X+1->X
End
Ok, now I have a question I have had but remembered with the second code, how does subtracting the keycodes do anything?
(Ans=26) is 0 if they aren't equal, 1 if they are. Same for any other true/false statement. 1 is true, 0 is false.
As such, X+(Ans=26)-(Ans=24)->X adds 1 to X if Ans is 26, and subtracts one if X is 24.
calcdude84se wrote:
(Ans=26) is 0 if they aren't equal, 1 if they are. Same for any other true/false statement. 1 is true, 0 is false.
As such, X+(Ans=26)-(Ans=24)->X adds 1 to X if Ans is 26, and subtracts one if X is 24.

Now it makes sense, thanks.
Is that for horizontal text sprites? It's a good technique to have good looking sprites in BASIC. Back when I used ASM libs to display individual sprites such as in The Reign of Legends 3 (long before Omnicalc became useable and long before tilemappers from xLIB/Celtic/DCS7), I wish the community knew about those tricks so I could have used those as alternative. Horizontal sprites are much faster than the old ASM libs I was using (due to Asm()+VAT searching issues).
DJ Omnimaga wrote:
Is that for horizontal text sprites? It's a good technique to have good looking sprites in BASIC. Back when I used ASM libs to display individual sprites such as in The Reign of Legends 3 (long before Omnicalc became useable and long before tilemappers from xLIB/Celtic/DCS7), I wish the community knew about those tricks so I could have used those as alternative. Horizontal sprites are much faster than the old ASM libs I was using (due to Asm()+VAT searching issues).

Yes it is actually, I wanted to find a way to make sprites without the use of ASM so I could do it at school when I was bored and didn't have work to do.

Here is a slight update, now it won't continue unless the Sprite length is as long as the inputed text.

Code:
:ClrHome
:1→L:0→θ
:While θ≠L
:ClrHome
:Input "TEXT :",Str1
:Input "SPR LENGTH: ",L
:Disp Str1
:Pause
:length(Str1→θ
:End
:ClrHome
:ClrDraw
:DispGraph
:For(X,1,L
:Text(0,X,sub(Str1,X,1
:Text(0,L+1," 
:End
:Return
Save yourself two bytes and change
Code:
1→L:0→θ
to
Code:
Delvar θ1→L


Could it be in

Code:
While θ≠L
. It'll continue, but Theta & L _must_ match here. Maybe you're inputting the wrong length into L when prompted.

Run the program again, input L get passed the Pause and when it clears the home screen break the program. Read the values of L & Theta, are they the same?
comicIDIOT wrote:
Save yourself two bytes and change
Code:
1→L:0→θ
to
Code:
Delvar θ1→L


Could it be in

Code:
While θ≠L
. It'll continue, but Theta & L _must_ match here. Maybe you're inputting the wrong length into L when prompted.

Run the program again, input L get passed the Pause and when it clears the home screen break the program. Read the values of L & Theta, are they the same?

I did that on purpose to avoid a Dim error.
And does anyone know how I can have them select which str they want to store it in? That way if somone wants to have it in a certain one, they dont have to switch strings later.
Got it.

As for the latter part you could use a menu, and have the user select Str0-9 then run the program with that specific code. But you can't have Dynamic Strings. You'll need to either write the program ten times, find a more efficient way to store the data in a defined string or use libraries.
Sonlen wrote:
And does anyone know how I can have them select which str they want to store it in? That way if somone wants to have it in a certain one, they dont have to switch strings later.


it's not quite what you're asking for, but try XTRAVAR ( http://www.ticalc.org/archives/files/fileinfo/391/39138.html ). Then, at the end of your program, you can copy the extra string into whatever string the user chooses.
It would still have to be an awkward set of If var=1:Blah->Str1:If var=2:Blah->Str2, etc. There's no dynamic way to store Blah to StrN where N is a variable.
  
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
» Goto page 1, 2, 3, 4, 5  Next
» View previous topic :: View next topic  
Page 1 of 5
» 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