#1✎ 76Tiger2Say I have a code similar to this:
So how do I make it so that each individual string prints under the other or in any specified place. When I tried a code similar to this, they all printed on top of each other making it look like one.
#2✎ 477SquareFingersIf you want strings printed at different locations on the screen, you need different LOCATE numbers just before the PRINT.
#4✎ 83seggiepantsIt looks like your code as written will print out "Horses" at 25, 10 and exit. You want it to write Horses on line 10, Dragons on line 11 and Lizards on line 12 right?
We are going to need to add some things to do that. A counter to keep track of where to write, and a loop to go through all of the data.
The loop needs to know when to stop. Either when we go off screen or run out of data.
For the data we can either have a sentinel value that lets us know to stop as the last data entry. Or we could have a data line with the total number of entries before the list.
My example goes with the sentinel value, and I chose "" as the value to stop on. Just seemed easier to add more stuff later that way.
Y = 10
WHILE C$ != "" AND Y < 30
LOCATE 25, Y
Y = Y + 1
Y keeps track of where to print. The and Y < 30 part stops us from going off screen. The first READ C$ primes the loop, the second one gets the next value to look at in the loop. We stop when we get to the empty string. Reading past the end of data will cause an error.
Hope that helps let me know if you have questions or if I have bugs or syntax errors in the example code.
#5✎ 76Tiger2Thanks. How might I load data to different pages that way if I scroll down inside the game a new list of words appear? I thought about using @ symbols for each page, but then I thought that in the dictionary I was creating, I wanted the player to be able to add words if he wanted to. So how would I make it so when they type in a word they want to add, a new 'data' line is add with the typed in word in the code?
Hope that makes sense...
#6✎ 76Tiger2Can you explain a bit more clearly how to make sure the computer automatically puts it all in alphabetical order or the order I choose?
#7✎ 477SquareFingersSelf-modifying code is generally a bad idea. To save an array of string data, the SAVE command can be used. Also, don't even try to figure out ahead of time where the page-breaks go, if the quantity of data is not known, or is changeable. Do it just after you get the data, or just before you draw a page.
#8✎ 83seggiepantsI made you a present 25D48V8V. It is a small dictionary application. Feel free to use it as a base for your own application. It sounds like you are making a Japanese/English Dictionary. It won''t do multiple definitions or a scrolling description area right now. But I think it should be close to what you want.
At the very least it should show what I meant about saving/loading files, and sorting. I also put in a binary search function for O(LogN) searching. There are some text based add-ons like UCASE$, SPLIT, and WINDOW_PRINT that may be useful too.
Get it while you can, the dictionary is full of 80's toy biographies from Wikipedia. who knows what words will trip the filter.
- Added a screen shot.
- Noticed a bug in the window_print function when handling return/line feed.
- Let me know if the link goes down.
#9✎ 76Tiger2Thanks, but the key didn't work