QB64.Net Homepage QB/QB64 Keywords QB Graphics Forum Homework Policy
How do you make an enemy move?by (no login)So I'm trying to make an RPG game, I want to know how I can move enemys without crashing into walls. I'm pretty new at this so you might have to explain it a bit. Thanks. |
You can use POINT or the SCREEN function in ASCII games to find the wall color or make up a map array of where the walls are to find them.
Before you move the sprite, make sure that you CAN move there. If you need to find the screen borders make sure the coordinates do not exceed the screen size. |
Re: How do you make an enemy move?by Rick4551 (no login)Well I already used arrays for my map to stop the actual player from going through the walls. But I really need to know how the enemies/AI move on their own and without crashing into walls. I had an idea of putting it into a loop but it would just loop the enemy movement and the actual you won't be able to move your guy. |
Here's a little program that explains it...by (Login qb432l)R It takes a bit of study, but once you understand the concepts, you can create any type of game play area and have AI pieces navigate that area as if they know where they're going -- but with all movement randomly generated. Their location on the map can be established by adding 100 to the square's value while they're there so your player knows if an enemy is there. Good luck! -Bob 'Copy code from here ------------------------------------------------------ 'AI NAVIGATION OF A PATH: Press F5 to run. 'A 2-dimensional array is dimmed representing a 16x24 square play area DIM Map(1 TO 24, 1 TO 16) AS INTEGER 'DATA reflects the values of the play area: 1 is non-path, 0 is straight 'path with no intersections, and intersections have values as follows... MapDATA: DATA 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 DATA 1, 6, 0, 0, 0, 0, 14,0, 0, 0, 0, 0, 14,0, 0, 0, 14,0, 14,0, 14,0, 12,1 DATA 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1 DATA 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1 DATA 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 7, 0, 15,0, 15,0, 13,1 DATA 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1 DATA 1, 7, 0, 0, 14,0, 15,0, 0, 14,0, 0, 13,1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1 DATA 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 7, 0, 0, 0, 15,0, 11,0, 11,0, 13,1 DATA 1, 7, 0, 0, 11,0, 13,1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1 DATA 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1 DATA 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 7, 0, 0, 0, 15,0, 0, 0, 0, 0, 13,1 DATA 1, 7, 0, 0, 0, 0, 13,1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1 DATA 1, 0, 1, 1, 1, 1, 7, 0, 0, 11,0, 0, 13,1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1 DATA 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1 DATA 1, 3, 0, 0, 0, 0, 11,0, 0, 0, 0, 0, 11,0, 0, 0, 11,0, 0, 0, 0, 0, 9, 1 DATA 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 'To begin with, each of the four possible directions of travel are 'represented by the lower four bits of a byte: 1, 2, 4 and 8. The "UP" 'direction is given a value of 1, "RIGHT" gets a value of 2, "DOWN" gets 'a value of 4, and "LEFT" a value of 8. 'An intersection's value then, is simply an addition of these values 'depending on which directions are possible. For example, the bottom- 'left turn in the grid has only two possible directions: "UP" and '"RIGHT", therefore its value is 1 + 2 = 3. An intersection wherein 'all directions are possible is valued as 1 + 2 + 4 + 8 = 15. I'm 'sure you get the idea. 'The direction an AI game piece is coming from is given the value of 'that direction. The variable "ExDIRECTION", for example, will have a 'value of 2 if the AI game piece is coming from the right. 'NOW... 'As the AI game piece moves, its Row and Column variables (Row/Col) are 'constantly updated based on the direction of travel. If the piece is 'moving to the left, then Col = Col - 1, etc.. 'Before the piece moves, its position relative to the map is checked. 'Map(Col, Row) will give us this value. If the value of that array 'element is zero, the piece simply continues along in the direction 'it has been going. If, on the other hand, the square has a value, 'then it is known to be an intersection and a turn must be determined. 'To begin with, there is a random value generated representing the 'four turns (1, 2, 4 and 8): 'NewDIRECTION = INT(RND * 4) + 1 'This will give a value of 1, 2, 3 or 4. Then we simply say: 'IF NewDIRECTION = 3 THEN NewDIRECTION = 8 'Hence, 1, 2, 4 or 8 are generated. 'Then we do what is called a bit-wise comparison of this random value 'with the intersection to see if our randomly-chosen turn is possible 'at that intersection. We simply AND NewDIRECTION with Map(Col, Row). 'Basically, what this is asking is, does my random turn exists at this 'intersection? If, for example, the random turn is 1 (UP) and the 'value of the intersection is 3 (UP/RIGHT), then the answer comes back 'YES (in other words, the 1-bit is set in the value 3 [0011]. This 'means that an "UP" turn is legal. The next thing that must be deter- 'mined is if the random turn is where we came from. If it is, then we 'try again, otherwise we'd constantly be bouncing off intersections 'rather than going through them. This is simply a case of comparing 'the NewDIRECTION variable with the ExDIRECTION variable to make sure 'they're not the same. 'The whole thing is enclosed in a DO loop that just keeps looping 'until it gets a viable result: 'DO 'Choose random direction (NewDIRECTION will = 1, 2, 4 or 8) 'LOOP UNTIL ((Map(Col, Row)) AND NewDIRECTION) '---line continues--- AND (NewDIRECTION <> ExDIRECTION) 'The above loop will execute instantaneously and with a viable turn. 'Now we have a new direction of travel, as well as a new "ExDIRECTION". 'The x/y increments are set accordingly and Row and Col are updated with 'each iteration of the main loop. 'ACTUAL PROGRAM BEGINS HERE ------------------------------------------------ 'Read DATA into map array RESTORE MapDATA FOR Row = 1 TO 16 FOR Col = 1 TO 24 READ Map(Col, Row) NEXT Col NEXT Row SCREEN 12 PALETTE 4, 63 'bright red for moving square 'Draw play area based on values in the array Row = 0: Col = 0 FOR x = 80 TO 540 STEP 20 Col = Col + 1 FOR y = 80 TO 380 STEP 20 Row = Row + 1 IF Map(Col, Row) <> 1 THEN Colr = 1 ELSE Colr = 9 LINE (x, y)-(x + 19, y + 19), Colr, BF NEXT y Row = 0 NEXT x COLOR 7 LOCATE 4, 31: PRINT "AI NAVIGATION OF A PATH" LOCATE 27, 33: PRINT "PRESS SPACE TO QUIT" 'Initialize AI game piece postion, both in terms of the array (Row/Col) 'and in graphical terms (x/y): Row = 2: Col = 2 x = 100: y = 100 Speed = 2 'increase to slow/decrease to speed up 'Start the main loop DO LINE (x, y)-(x + 19, y + 19), 1, BF 'erase old game piece postion IF Map(Col, Row) <> 0 THEN 'make sure we're at an intersection 'NOTE: We are at an intersection to begin with which is why there 'was no need to initialize the variable ExDIRECTION '------------------- the random loop explained above -------------------- DO NewDIRECTION = INT(RND * 4) + 1 IF NewDIRECTION = 3 THEN NewDIRECTION = 8 LOOP UNTIL (Map(Col, Row) AND NewDIRECTION) AND (NewDIRECTION <> ExDIRECTION) '------------------------------------------------------------------------ END IF 'Establish increments, Row/Col changes based on NewDIRECTION (which 'remains unchanged if the square was a zero). SELECT CASE NewDIRECTION CASE 1: IncX = 0: IncY = -20: Row = Row - 1: ExDIRECTION = 4 CASE 2: IncX = 20: IncY = 0: Col = Col + 1: ExDIRECTION = 8 CASE 4: IncX = 0: IncY = 20: Row = Row + 1: ExDIRECTION = 1 CASE 8: IncX = -20: IncY = 0: Col = Col - 1: ExDIRECTION = 2 END SELECT x = x + IncX: y = y + IncY 'graphical x/y incrementation 'Draw/PUT game piece LINE (x, y)-(x + 19, y + 19), 4, BF CIRCLE (x + 10, y + 10), 6, 14 PAINT STEP(0, 0), 14 'Wait for retrace (creates adequate pause so we see the game piece) FOR Delay = 1 TO Speed WAIT &H3DA, 8 WAIT &H3DA, 8, 8 NEXT Delay a$ = INKEY$ 'check for exit request LOOP UNTIL a$ = " " 'main loop terminates
|
The program knows where you are so move the enemy in that direction. If it encounters a wall, it will have to move in a free direction trying to move toward you in a column or row direction. |
it could get trappedby Ben (no login)http://en.wikipedia.org/wiki/Pathfinding read this, try to post some code here that works somehow like your game for the members here could adapt to your situation in their solutions |
Going towards a different approachby Rick4551 (no login)Ok so I'm going for a different approach. Instead of having the enemy move and attack on its own I'll just make it intiate a battle, where you pick to attack, defend or heal and the computer does the same. I did all that but now my main problem is that everytime the battle ends I can't move the person anymore, I've tried exit do which doesn't help. Here is the part of the code: Drawmaps are a sub drawmap col% = 3 row% = 3 x% = 16 y% = 16 score% = 0 PUT (88, 112), glass() PUT (x%, y%), hero() herohealth% = 100 heroarmor% = 100 DO '*****************************movement code k$ = INKEY$ IF k$ = CHR$(0) + CHR$(77) THEN 'right arrow key IF MID$(map$(row%), col% + 1, 1) = " " THEN PUT (x%, y%), hero() x% = x% + 8 col% = col% + 1 PUT (x%, y%), hero() score% = score% + 1 END IF ELSEIF k$ = CHR$(0) + CHR$(75) THEN 'left arrow key IF MID$(map$(row%), col% - 1, 1) = " " THEN PUT (x%, y%), hero() x% = x% - 8 col% = col% - 1 PUT (x%, y%), hero() score% = score% + 1 END IF ELSEIF k$ = CHR$(0) + CHR$(80) THEN 'down arrow key IF MID$(map$(row% + 1), col%, 1) = " " THEN PUT (x%, y%), hero() y% = y% + 8 row% = row% + 1 PUT (x%, y%), hero() score% = score% + 1 END IF ELSEIF k$ = CHR$(0) + CHR$(72) THEN 'up arrow key IF MID$(map$(row% - 1), col%, 1) = " " THEN PUT (x%, y%), hero() y% = y% - 8 row% = row% - 1 PUT (x%, y%), hero() score% = score% + 1 END IF '**********************end of movement code END IF LOCATE 1, 1 PRINT "Score:"; score% LOCATE 2, 2 PRINT x%; " "; y% LOCATE 1, 27 PRINT "Health:"; herohealth% LOCATE 2, 27 PRINT "Armor: "; heroarmor% IF x% = 88 AND y% = 112 THEN PUT (280, 40), arrow() END IF IF x% = 296 AND y% = 40 THEN CLS drawmap2 x% = 8 y% = 40 col% = 2 row% = 6 PUT (x%, y%), hero() PUT (16, 64), badguy() PUT (64, 24), badguy() PUT (120, 40), badguy() PUT (136, 40), badguy() PUT (184, 40), badguy() END IF IF x% = 16 AND y% = 64 OR x% = 64 AND y% = 24 OR x% = 120 AND y% = 40 OR x% = 136 AND y% = 40 OR x% = 184 AND y% = 40 THEN enemhealth% = 100 enemarmor% = 100 '**************************battlemap DO CLS OPEN "J:\qb\btlmap.txt" FOR INPUT AS #9 row% = 0 mapx% = 0 mapy% = 0 DO row% = row% + 1 LINE INPUT #9, map$(row%) FOR col% = 1 TO LEN(map$(row%)) IF MID$(map$(row%), col%, 1) = "w" THEN PUT (mapx%, mapy%), map() END IF mapx% = mapx% + 8 NEXT col% mapx% = 0 mapy% = mapy% + 8 LOOP UNTIL EOF(9) CLOSE #9 PUT (96, 64), hero() PUT (208, 64), badguy() '***************************end of battlemap drawing LOCATE 14, 9 PRINT "Please choose something:" LOCATE 16, 10 COLOR 47 PRINT "D: Defend" LOCATE 18, 10 COLOR 40 PRINT "A: Attack" LOCATE 20, 10 COLOR 54 PRINT "H: Heal" LOCATE 1, 1 PRINT "Score:"; score% LOCATE 1, 20 PRINT "Your health:"; herohealth% LOCATE 2, 20 PRINT "Your armor: "; heroarmor% LOCATE 4, 20 PRINT "Enemy health:"; enemhealth% LOCATE 5, 20 PRINT "Enemy armor:"; enemarmor% LOCATE 22, 9 INPUT opt2$ enemopt% = RND + 1 enemattak% = RND * 10 + 10 heroattak% = RND * 10 + 10 IF UCASE$(opt2$) = "D" THEN 'defending code ELSEIF UCASE$(opt2$) = "A" THEN 'attack code ELSEIF UCASE$(opt2$) = "H" THEN 'healing code END IF IF herohealth% <= 0 THEN 'cut the code for the game over screen END IF IF enemhealth% <= 0 THEN CLS drawmap2 x% = x% + 8 'this the that's giving me problems col% = col% + 1 'don't know how to get the game to show PUT (x%, y%), hero() score% = score% + 150 EXIT DO END IF LOOP END IF LOOP UNTIL k$ = CHR$(27) 'esc key to end |
Re: Going towards a different approachby Rick4551 (no login)Never mind I found the problem but thanks for the help. :) |
Move It -- Just for funby Solitaire (Login Solitaire1)S My back went out several weeks ago (the day before New Year's Eve) and I've had a lot of trouble moving around. At my age, it's taking a long time to recover and I've been homebound for the most part. (I was home alone watching the Times Square ball drop on TV.) My son drove me to school on the days I had to teach. My students helped open doors, carry my stuff and pass around the handouts. Just for fun, I wrote a short QB program to move a smiling face across, down, and diagonally across the screen. It moves faster than I can. CLS FOR x = 2 TO 23 LOCATE 3, 30 LOCATE 10, 35: PRINT "_ _"
|
Thanks for sharing...I know how you feel.
![]() |
Solitaire, I love your programsby AlGoreIthm (no login)Please Get Well Soon! ============================================================================== CLS heading$(1) = "Move Across" heading$(2) = "Move Down " heading$(3) = "Move Diagonally" limit%(1) = 80: stp%(1) = 2 limit%(2) = 23: stp%(2) = 1 limit%(3) = 80: stp%(3) = 4 FOR round% = 1 TO 3 COLOR 7: LOCATE 2, 30: PRINT heading$(round%) COLOR 14 y% = 4 FOR x% = 2 TO limit%(round%) STEP stp%(round%) IF round% = 2 THEN LOCATE x%, y% ELSE LOCATE y%, x% PRINT CHR$(1) t = TIMER DO WHILE (t + .12) >= TIMER LOOP IF round% = 2 THEN LOCATE x%, y% ELSE LOCATE y%, x% PRINT " " IF round% = 3 THEN y% = y% + 1 NEXT x%, round% LOCATE 9, 32: PRINT CHR$(218); STRING$(9, CHR$(196)); CHR$(191) FOR x = 10 TO 15 LOCATE x, 32: PRINT CHR$(179); TAB(42); CHR$(179) NEXT x LOCATE x, 32: PRINT CHR$(192); STRING$(9, CHR$(196)); CHR$(217) LOCATE 10, 35: PRINT "_ _" LOCATE 11, 35: PRINT CHR$(239); " "; CHR$(239) LOCATE 13, 37: PRINT "^" LOCATE 14, 35: PRINT "\___/" COLOR 7 LOCATE 20, 36: PRINT "OK" END
|
Interesting revisionby Solitaire (Login Solitaire1)S I made a slight correction in 3 places where double or triple spaces should have been instead of a single space after it was posted. It did look a bit off when I ran it -- the eyes were not centered, and the "Move down" didn't cover the previous "s" I added Alt(255) to those 3 places in my post as well as in yours. I had never before seen a single NEXT instruction to include the ending of two loops, the way you have it. Interesting. I used variables instead of literals when creating the face. That made it a lot easier to center and size the box, and place the features correctly. Glad you liked it.
|
*LOL - I get "moves faster than I can". My back went out recently, lasted two weeks.by (Login qb432l)R * |
Colors and Patterns -- with link to a subforum for the codeby Solitaire (Login Solitaire1)S I posted the program code to the "Big Programs" subforum, even though it's not all that big. I don't understand how the "Proud" subforum works. I have 81 "replies" listed under my name, with dozens of programs, all of them using a single url. How can the individual programs be separated and accessed? Here is the program I wrote a while back and revised a few days ago. It has multiple options for changing the foreground color, background color, text color, and non-alphanumeric characters to create hundreds of various patterns. It displays the values of all the combinations, so a designer can select the pattern combination of choice, and use those values to create a pleasing screen for whatever purpose is needed. Enjoy!
|
*Nice work -- lots of fun exploring the myriad combinations.by (Login qb432l)R *
|
at: ELSE 'will use ASCII value of valid input number w = ASC(sv$) 'new character will assume CHR$ of ASCII value I think it should be something like: ELSEIF v > 0 THEN w = v ELSE w = ASC(sv$) Regards, Michael
|
Is it really needed?by Solitaire (Login Solitaire1)S That would account for any values I had omitted, but I think all of them were accounted for. Is there anything that was left out? Instead, I need to add another condition to the end of the line beginning with ELSEIF v = 7 to test for IF v is less than 0 and include it in the nested IF block testing for the correct range. I made that change in the program listing.
|
There is no mechanism to set w = v. So, if I press "c", then type "254", I see "2" instead of "■". Likewise, if I press "c", then type "&hfe", I see "&" instead of "■". My suggested change was probably not the best or most efficient fix. It was just a small hack that would make the ASCII value entry work. Regards, Michael |
Solitaire, Would you Consider -by AlGoreIthm (no login)Rather than using a numeric system for those characters, use a long string that incorporates all the characters you want to allow and then programming that section accordingly. This would greatly simplify many of your IF-THEN (ELSE lines because all you need really to check for is re-setting the end of the string back to 1. One of the advantages of using a long string of characters is that you can actually create the consecutive order that the characters will appear in: EX: the following are not in ASC order: "!@#*&^$%" , but they would appear in the order you see in the string, so you get to set it up exactly the way you want it to come out. |
OK. I fixed it.by Solitaire (Login Solitaire1)S Thanks for the feedback. My original program used: ELSE w = v but with all the extra options I added, it resulted in a solid black background. I tested it with single characters but didn't anticipate that the ASCII numbers would no longer work. I added a new string variable - sv1$ - to test for the VAL of the first character. If it was 0 and not "0" then I made sv$ = sv1$ I added this to the condition that also tested single digits to use the ASCII value of the first character. Then changed the ELSE to w = v. It should be working fine now. I revised the program code in the subforum to reflect the changes. ============================================================ About the suggestion to use a long string instead of multiple ELSEIFs, that would be very impractical. First of all, most of those characters are not on the keyboard and it would require a CHR$() with each one of those. Secondly, with the numbers in code, you can see exactly which values are being skipped.
|
context menusby Ben (no login)what would be a good data structure to store content for sub menus & sub sub sub... menus etc that's unlimited |
Would you need to add or subtract items at runtime? well, there's: http://en.wikipedia.org/wiki/Tree_%28data_structure%29 Whether it's the best or not, I don't know. You could have an array of strings, perhaps a dynamic one. Each string, perhaps, could start with the MKI$() of the index of the parent, then the MKI$() of the number of children it has, then, for each chile, one MKI$() of the index of the child, then the name of the item. That should do the job, but there might be better ways of doing it. If the language has REDIM _PRESERVE, it should be easy to extend it at runtime. You should be able to add items to the end of the array, and update the string of the parent. If it doesn't need to be extendable at runtime, you might be able to reduce the number of MKI$()s by making rules about the order and relative position of the items. I haven't given a whole lot of thought to it at the moment. One potential problem is that variable length string space is a very limited resource in QBASIC 1.1. This method might work better in QB64. One potential workaround, if the items don't need to be extendable, would be to move everything to DATA statements. Regards, Michael |
Re: context menusby Ben (no login)extendable at run time is always good. I do have redim preserve. one thing that i'm most trouble deciding is rather the data text format but how to distinguish sub menus from main menus and so on one i was thinking using like >'s and <'s menu1> menu2 menu3 submenu1> submenu2 submenu3 subsubmenu1> subsubmenu2< submenu4< menu4 menu5< i dont want to use multidimensional arrays because they are not resizable, and using >'s and <'s is requries string parsing and strring operations are inefficient if there was a way to distgnush andother way or another. |
you could have 2 arrays, one strings with the names, then another integers with the number of children. i might respond more later. regards, michael |
Patterns in color - (but need info on the symbol display)by Solitaire (Login Solitaire1)S I revisited an old program I wrote a while back and revised it to add more options and make it work better. Anyone who is designing a program in text mode can make use of this mulit-faceted display to select just the right combination of colors and patterns for their purpose. I'd like to post the code here but the forum still has a problem displaying the Less Than symbol. It looks correct in the preview but not after posting. I don't have the information on how to correct the display, and I didn't see it in the FAQ, so please post the info here. Also, it really should be included in the FAQ. Thanks. |
|
I have found, Solitaire...by (Login qb432l)R That if you post code with these symbols, then edit the posted code with the formatted text box unchecked, they will display properly. For example: These symbols were typed and posted: IF a < b AND c > a THEN Oops! It posted properly just by unchecking the formatted text box. I didn't have to edit it. Never used to work that way, before. -Bob
|
Don't have that box.by Solitaire (Login Solitaire1)S Where IS this "formatted text" box? I simply don't have it. All I see is this message at the bottom: > If "Enable formatted text" box appears above, UNCHECK it if you are posting code. Well, I don't see any such box anywhere on my screen. |
|
* IE8by Solitaire (no login) |
*Odd -- I have IE9, but all my previous versions showed the box (???).by (Login qb432l)R * |
|
It doesn't matter whether or not I'm logged in.by Solitaire (Login Solitaire1)S I still don't have that box. I do have a Message Text with options to change the font, size, and text formatting, but no way to uncheck anything. So how can I post my code? It looks good in the preview, but totally convoluted after posting, since I have dozens of those symbols. All I could do was delete the post.
|
Here is what I see in IE8 and Firefox 9 when logged in: http://qbasicmichael.com/downloads/ie8.png http://qbasicmichael.com/downloads/ff9.png My first recommendation is to try it in Firefox. Otherwise, I recommend to email it to someone else to post. Otherwise, you'll have to use the HTML entities: http://w3schools.com/html/html_entities.asp for <, < should work in addition to < and < Perhaps write a program to automatically replace all the offending characters with the HTML entities, including replacing spaces with the nbsp entity. Regards, Michael |
I seldom see a link in your posts that is clickable...
![]() |
I just downloaded Firefox.by Solitaire (Login Solitaire1)S But the forum screen is exactly the same as before. No formatted text box.
|
especially since all the Firefox settings should be independent from the IE settings. (Unless you chose to import IE's settings.) You don't have cookies or JavaScript disabled, or anything, do you? Nevermind, I just tried Firefox with JavaScript disabled, and I still see the checkbox. I wonder if you're going through some sort of proxy that is changing the web page. Or perhaps, IE and Firefox are sharing a DLL that helps with the rendering? Please try to view the page source of the message reply page: If in Firefox, go to the "Tools" menu, the "Web Developer" sub menu, then choose "Page Source". It should contain something like: <input type=checkbox name=htmlpostison value=o checked> Enable formatted text <a href="http://www.network54.com/Help/FormattedText.html" onclick="return largepopupwindowopen('http://network54.com/Help/FormattedText.html')">(Huh?)</a><br> If not, then you probably have some sort of proxy or filter removing it. Regards, Michael |
Michael: I don't have that line in Firefoxby Solitaire (no login)I followed your instructions but didn't see that line in the Page Source. If it's because of a proxy or filter, how do I disable it?
|
I don't recall any problems there and there is no Formatted check box either. |
Out of curiosity, do you have the "Also send responses to my email" checkbox? ---------------- For proxy settings: ---- FF In Firefox, they are under "Tools", "Options", the "Advanced" graphical tab, the "Network" tab, "Connections", the "Settings" button. On mine, it's set to "Use system proxy settings". You might eventually try the "No proxy" option, but first I would look at IE's settings: ---- IE In Control Panel, select "Internet Options". You can also get there from Internet Explorer by selecting "Tools", "Options." Once there, go to the "Connections" tab. If you connect through dial up, find the connection in the list, select it, then click "Settings". See if the checkbox is checked under "Proxy server". If you connect through normal "wi-fi" or an ethernet port, click "LAN Settings". See if the checkbox is checked under "Proxy server". ---- If you do have proxies enabled, I would try disabling them. I don't know how you connect to the internet. If you're not the one who set up your network, it might be a good idea to talk to the administrator. ---------------- It is possible that some sort of antivirus, spam/privacy filter, toolbar or something is causing this. (I think some antivirus programs do use the proxy settings on your computer.) Depending on which antivirus you have, you might check its settings to see to what extent it is filtering your web browsing. It is also possible that your Internet Service Provider is filtering the connection. Toolbars/extensions: ---- FF Also, you might go through Firefox's add-ons, looking for anything out of the ordinary. In Firefox, click "Tools", "Add-ons". There will be graphical tabs at the left. First, look at "Extensions". On mine, the only one I didn't manually add is the .NET framwork one. There are several that I installed manually (Unplug, Flashblock, Mozilla Archive Format). Also, look at "Plugins". On mine, there are ones from Google, Java, Microsoft (Siverlight, Media player, etc.), and Shockwave Flash. However, there is nothing antivirus related, and there are no toolbars. ---- IE You can do the same in Internet Explorer. Under the "Tools" menu, select "Manage Add-ons". Here also, you will have 4 graphical tabs at the left. For example, I have 2 add-ons from Spybot Search & Destroy under "Toolbars and Extensions". ---------------- There are other things, if none of the above works. There is a program called HijackThis. http://www.trendmicro.com/ftp/products/hijackthis/HijackThis.exe I would not recommend removing anything with it unless you know what you are doing. However, the log it can produce might be insightful. It is possible that the problem is caused by malware. There are tools and techniques for detecting and removing malware. Normally, I use CCleaner, ProcessExplorer, Microsoft Security Essentials, Spybot Search & Destroy, and HijackThis. Google the name of anything that you find that looks suspicious. If I suspect problems, then I also use Malwarebytes Anti-Malware. If I suspect a possible rootkit, I use Gmer. I can't really walk you through a detailed malware cleanup here. If you suspect a malware problem, there are forums, for example, Bleepingcomputer, that can walk you through a detailed malware cleanup. Or, if you have a qualified, trustworthy, and affordable computer tech in your area, you might have him/her check out your computer. Regards, Michael
|
Partial follow-up infoby Solitaire (Login Solitaire1)S I'm on IE. We're using a hi-speed (Verizon) internet connection. Everything is on a home network my son set up. I looked up LAN settings, but the Proxy server box is not checked. It looks like my son installed the Kaspersky Anti-Virus 1012 program. We used to have AVG but the QB forum page was still the same. It looks like Kaspersky blocks ActiveX software. Is this what the text formatting box is made with? I don't have either of the Options boxes on the QB edit screen checked -- (Also send responses to my email address; Include Signature).
|
You have the other 2 checkboxes? So you have: <input type=checkbox name=autorespond value=yes > Also send responses to my email address<br><input type=checkbox name=sigonbox value=o CHECKED> Include Signature in the source, but not the: <input type=checkbox name=htmlpostison value=o checked> Enable formatted text <a href="http://www.network54.com/Help/FormattedText.html" onclick="return largepopupwindowopen('http://network54.com/Help/FormattedText.html')">(Huh?)</a><br> :-P No, it shouldn't be ActiveX. Clippy's idea sounds good. There are subforums that don't even give the option of formatted text. The big programs subforum is another, Regards, Michael |
*ROFL - Type a variable named as "local = 10" in the QB IDE... then press F1 for help.by Pete (Premier Login iorr5t)Forum Owner |
To add injury to insult...by (Login qb432l)R local = 10
PRINT local The above code gets an error message (Expected statement). You'd think they'd at least let you use it as a variable name if you can't use it for anything else. -Bob |
|
*And never will be. Same with 'SIGNAL'by Galleon (no login) |
Three doors dilemma [corrected]by (no login)I'm sorry for my former topic, I forgot I was on a Global Forum. I have written the code underneath this text, im just a newbie, but I really cant seem to find out, what it is im doing wrong. All the is to it, is that i dont want c to be the same as a OR b en d not the same as b OR c My logic tells me this code should suffice but i see a lot of occasions were d is the same as b. Please help me out here CLS ' a- car ' b- choice ' c- rejected ' d- alternate proposal RANDOMIZE TIMER / 3 a = RND a = INT(a * 3) + 1 INPUT "1/3"; b fout: c = RND c = INT(c * 3) + 1 SELECT CASE c CASE IS = a OR b GOTO fout CASE ELSE END SELECT alternatief: d = RND d = INT(d * 3) + 1 SELECT CASE d CASE d = b OR c GOTO alternatief CASE ELSE END SELECT PRINT "You have chosen"; b; "I would like to tell you it isnt"; c; "would you like to change your choice to"; d; "" INPUT "ja(1) / nee(2)"; e SELECT CASE e CASE IS = 1 IF d = a THEN PRINT "you won!" ELSE PRINT "you lost" END IF CASE IS = 2 IF b = a THEN PRINT "you won" ELSE PRINT "your lost" END IF END SELECT END |
SELECT CASE c CASE a, b CASE ELSE END SELECT List possible values with comma separations. CASE IS can use =, <>, <, >, >= or <=
|
Convoluted code is very hard to understand.by Solitaire (no login)Your code makes no sense whatsoever. First of all, get rid of the GOTOs. It makes the code convoluted and impossible to understand. The SELECT CASE block should be self-contained and easy to read. You took an easy block and turned it into something complex. Why do you have /3 after RANDOMIZE TIMER? That makes no sense. You should use a range with the correct formula for a random number. For example, to select a number between 1 and 5, you would do this: a = INT(RND * 5) + 1 What is the user supposed to enter? You don't display any instructions. If you want something to repeat, use a DO LOOP with a condition to stop repeating. SELECT CASE does not use logical operators (like OR). A comma is used instead to separate the values. You don't even need to use IS =. For example: SELECT CASE a CASE b, c, d PRINT "Incorrect" CASE e PRINT "Correct" END SELECT However, in your program, a SELECT CASE block is not even needed. Maybe this is what you want: CLS RANDOMIZE TIMER a = INT(RND * 5) + 1 DO INPUT "Enter a number: ", b IF b <> a THEN PRINT "Incorrect. Try again." END IF LOOP UNTIL b = a PRINT "You got it." END |
GOTOsby Docfxit (no login)Speaking of GOTO statement, I've noticed you're someone who will do anything to avoid a GOTO statement in any situation, like using 'flags' to break out of nested loops. I've been required to use a GOTO statement in this one situation where under a certain condition, my program requires going back to the beginning of the main loop: DO start: 'important code here 'modifies x IF x THEN GOTO start LOOP Having another outside loop like this: DO DO 'main loop LOOP LOOP would not work because there are also other conditions which would require breaking out of the outside loop, and use goto as well. What would you recommend? |
DO
DO LOOP WHILE X LOOP OR: 10 DO IF x THEN 10 LOOP |
first one wouldn't work because i have stuff after the IF x and second one uses goto exactby gayboy (no login)ly like mine |
|
No GOTOby Solitaire (Login Solitaire1)S Anything is possible without needing to resort to using a GOTO statement. Several programming languages exist which do not have this keyword at all. Instead of branching off to another part of the program, use subprocedures which can be coded once and called several times from any part of the main program. This makes your code a lot easier to read and debug. Post your code for more suggestions.
|
* Luckily I have Windows, so I don't need three doors. :)by Pete (Premier Login iorr5t)Forum Owner |
3 deuren dillema, please cheackby Martijn Kruizinga (no login)ik heb onderstaande code, het mag op zich voor zichzelf spreken ik wil een simulatie doen van het 3 deuren dillema. Maar wat gaat er mis? Het idee hiervan is dat c niet hetzelfde mag zijn als a of b d mag niet hetzelfde zijn als b of c HELP!!! CLS ' a- auto ' b- keuze ' c- uitgesloten ' d- alternatief voorstel RANDOMIZE TIMER / 3 a = RND a = INT(a * 3) + 1 INPUT "1/3"; b fout: c = RND c = INT(c * 3) + 1 SELECT CASE c CASE IS = a OR b GOTO fout CASE ELSE END SELECT alternatief: d = RND d = INT(d * 3) + 1 SELECT CASE d CASE d = b OR c GOTO alternatief CASE ELSE END SELECT PRINT " je hebt gekozen voor"; b; "ik wil je vast vertellen dat het "; c; " niet is, wil je kiezen voor"; d; "" INPUT "ja(1) / nee(2)"; e SELECT CASE e CASE IS = 1 IF d = a THEN PRINT "je hebt gewonnen!" ELSE PRINT "je hebt verloren" END IF CASE IS = 2 IF b = a THEN PRINT "je hebt gewonnen!" ELSE PRINT "je hebt verloren" END IF END SELECT END |
A WIKI job for Clippyby Galleon (no login)The new QB64 help system works great with almost all the WIKI pages. The problem is they are too verbose. The main WIKI page is not what people need to see when they open help in the IDE. To give you an idea only about 10 lines are visible (without scrolling) so we need to make the content that is displayed concise. Maybe you would like to put together a help "home page" for the IDE to use as its default? |
I am always on your site daily. What do you want the opening page to include? I can link to the Alphabetical and By Usage pages with the Main Page appendix and QB64 links too. Every section of the main page is a link in itself so they don't all need to be displayed all at once.
To see what I mean, go to the Main Page and click the Edit areas. The new link will be in the url after it has been saved. You don't need to change anything: http://qb64.net/wiki/index.php?title=Main_Page#Keywords: I can make a page that has some of the links if you want that. It can be made so that only the Help Menu can see it. Here is a page I just created. If you want, add things that you feel are needed. I will find the links for them. http://qb64.net/wiki/index.php?title=QB64_Help_Menu
|
*I'll follow this up in the QB64 discussion forum (link*)by Galleon (no login)http://www.qb64.net/forum/index.php?topic=5122.0 |
qb64 is too slowby (no login)I worked in QB 4.5 and PDS 7 and have some programs. Now I find qb64 and try to run my programs in it. It previously creat exe-file and work very slowly. Is there some way to do this more quickly? Sorry for my english. Sergey |
*How big are the .BAS files you are working with?by Galleon (no login) |
qb64 is slowly than qb45by (no login)Not so big - 5 -20 kb only. But time difference between qb45 and qb64 is significant. I think that the reason of this is creation of exe-file. And some more: Runing my programs I find, that qb64 do not know user defined functions: Command not implemented on line 47 DEF fnacs (x) = 1.571 - ATN(x / SQR(1 - x * x)) Thank you for your cortesy! Sergey |
Qbasic had an interpreter that could run your code instantly.
If you can still run Qbasic, use it to create your code and save the BAS files as Text readable when saved. Once you are happy with the results, compile it. The compiler changes your code to C++ code and compiles it. Several people have worked on an interpreter, but no luck yet.
|
SELECT EVERY CASEby Herman Cain (Premier Login iorr5t)Forum Owner A poll at QB64 asks if a SELECT EVERY CASE would be a good keyword. I'm all for it. For instance, if I wanted a pepperoni pizza with extra cheese and mushrooms, I could order a 2,4,6 CLS PRINT "Godfather's Pizza Menu." SELECT EVERY CASE pizza$ REM I am Herman Cain, and I approved this code.
|
* Dammit Herman. 9-9-9 means Nein! Nein! Nein!by Female German Godfather's Pizza Worker. (Premier Login iorr5t)Forum Owner |
|
EXIT SELECT would be rather usefulby Ben (no login) |
Problem there is...by (Login qb432l)R ...(besides the fact that I can't get olives on my pizza) you have to depend on the user to enter a string with the proper format. I'm in favor of it in principal, but idiot-proof it ain't. What would happen, for example, if someone were to take a very long, confused pause right in the middle of their order?
-Bob |
Funny how Pete always tends to think about pizza isn't it... |
Hey Bob, I'm sorry you can't get olives on your pizza but...by Popeye the Coderman (Premier Login iorr5t)Forum Owner I'm glad Bluto can't get Olive's on his sausage!
|
|
Actually that code wouldn't work!by Galleon (no login)If you entered the string "2,4,6" nothing would happen according to current case condition rules. |
That might be a good idea too... |
Message to Mr. Obama on this Jan 1st., 2012...by G.O.P. (Premier Login iorr5t)Forum Owner PRINT "HAPPY NEWT YEAR!" 'And get your 2013 Mayan calendars before time runs out. Buy yours now on ebay! '
|
|
QBASIC DIVISION RESULT QUESTION.by (no login)LET DAY.INT.EXPENSE! = YEAR.INT.EXPENSE! / 365% YEAR.INT.EXPENSE! IS ' 28 ' DAY.INT.EXPENSE! IS ' 7.671233E-02 ' <=== INCORRECT DAY.INT.EXPENSE! SHOULD BE SOMETHING LIKE ' .07671233 ' IF THE CALCULATED ANNAUAL INTEREST EXPENSE IS $28, THEN THE DAILY INTEREST EXPENSE SHOULD BE $.0767 N O T $7.67. WHY IS THE RESULT ' 7.671233E-02 ' ????? LET DAY.INT.EXPENSE! = YEAR.INT.EXPENSE! / 365% YEAR.INT.EXPENSE! IS ' 42 ' DAY.INT.EXPENSE! IS ' .1150685 ' <=== CORRECT THE ABOVE RESULTS ARE CALCULATED FROM THE SAME (EXACT)ROUTINE. |
7.671233E-02 is actually the value .07671233
E-02 means that the decimal point is moved two places to the left. If you want to display a notated number to a user use PRINT USING with one less decimal point place in the format template: PRINT USING "###.######"; DAY.INT.EXPENSE! The notated value will still calculate correctly. |
QBASIC DIVISION PROBLEM.by (no login)Hi Clippy, I'll try to be as brief and concise as possible. I attempted to enter the acutal code from my .BAS file (program) but there was no space left in this 'Message Text' area to write any comments. I'll try to fit part of it. Here goes: 000502 LET YEAR.INT.EXPENSE! = MONEY.NEEDED.KEY1! * INTEREST.RATE.KEY1! 000503 LET MONTH.INT.EXPENSE! = YEAR.INT.EXPENSE! / 012% 000504 LET WEEK.INT.EXPENSE! = YEAR.INT.EXPENSE! / 052% 000505 LET DAY.INT.EXPENSE! = YEAR.INT.EXPENSE! / 365% THE CONTENTS OF THE VARIABLES ARE LISTED BELOW. MONEY.NEEDED.KEY1! INTEREST.RATE.KEY1! DAY.INT.EXPENSE! 1400 .02 7.671233E-02 1400 .03 .1150685 My instincts tell me that either BOTH results should contain 'E-02' O R NEITHER SHOULD. Please be as specific and technical, if necessary, in answering the following questions. Q01. Specifically, why DOES the first result above CONTAIN 'E-02' ??? Q02. Specifically, why DOES the second result above NOT CONTAIN 'E-02' ??? Thanks again for your time and expertise. Regards, Vince G. |
When a SINGLE value requires more than 7 digits the value adds the E+ or E- to indicate the decimal point placement.
DOUBLE values can use up to 15 decimal places before using D+ or D-. |
In other words....by Solitaire (no login)The result of the first equation came out to no more than 7 digits after the decimal so it could display as is. The result of the second equation was more than 7 digits so it reverted to scientific notation. If you were to declare your variables as type DOUBLE (using # instead of !) the first result should still be the same, but the second may or may not display in scientific notation depending on whether or not the number of digits after the decimal was more or less than (or equal to) 15. |
Type SINGLE is limited to 7 places after the decimal point.by Solitaire (no login)Using the ! suffix declares your variable as type SINGLE. After 7 places, the result will revert to scientific notation. The same is true for type DOUBLE, which is limited to 15 places and will still result in scientific notation if the result is longer than that. In order to display the maximum amount allowed within the limits of the type memory, you can force the result to round up to the nearest value with 7 places for type SINGLE, as follows: YEAREXPENSE = 28 DAYEXPENSE = YEAREXPENSE / 365 DAYEXPENSE = DAYEXPENSE * (10 ^ 7) DAYEXPENSE = INT(DAYEXPENSE + .5) DAYEXPENSE = DAYEXPENSE / (10 ^ 7) PRINT DAYEXPENSE To display the result with fewer places, just substitute a smaller value for the 7. If you use PRINT USING as recommended by Clippy above, it will display the result with the number of places indicated, although internally, the longer value will still be in memory. To keep the original value of DAYEXPENSE in memory, you may wish to substitute a different variable temporarily and display that value after it computes the rounded result. Example: YEAREXPENSE = 28 DAYEXPENSE = YEAREXPENSE / 365 num = DAYEXPENSE num = num * (10 ^ 7) num = INT(num + .5) num = num / (10 ^ 7) PRINT num PRINT "Original value: "; DAYEXPENSE |
QBASIC DIVISION RESULT CONTAINING 'E-02''.by (no login)Hi Solitare, First I want to appologize for not responding sooner. Your response was nothing less than 'TOP NOTCH'. It was CLEAR, CONCISE, PRECISE and UNDERSTANDABLE. For me, it was one of the best, if not the best response I have received in regards to a question I posed. Thanks again. Regards, Vince G. |
Program QBasic as 32 bit codeby Rufus (no login)http://www.rtrussell.co.uk/ You can run many QBasic programs as 32 bit code and with a bit more effort write new QBasic programs and run them as 32 bit code. Go to the above website and download the QBasic to BBC Basic converter. Follow the instructions for the simple installation. On Vista I found it necessary to put the small download in a separate directory on the C drive before running it. When the program is run two windows open. Load your old code into the left hand window and convert it to BBC Basic which appears in the right hand window. You can now run your code. For test purposes you can write new QBasic programs using the left hand window as a simple editor. There are no facilities for saving new programs but you can do a copy and paste operation into Notepad. Save your program with the *.bas extension so that it will load when required Better still download Notepad++ and customise it to understand QBasic keywords. You will now have a nice system allowing you to write new QBasic programs with nicely highlighted and indented source code for easy readability. You can use lower case if like me you prefer it. There are some bits of QBasic which are not translated as you will see if you read the documentation. I don't find this a problem. If you find this system useful then you might like to let Mr Russell know. Some day he might be willing to spend some time and effort in enhancing it. I would especially like to see some higher screen numbers for even better graphics. |
It also has an IDE that can create programs. |
HAPPY NEW YEAR!by Pete (Premier Login iorr5t)Forum Owner Well nearly, only a little past 8:45 West Coast time. Will 2012 be the year of qbasic? It may be poised for a comeback! Well, one can dream, and thanks to dreams, we have QB64. Anyway, it's good to see the mods taking such good care of the forum, and I hope this posts puts the "A" in Rob's Q and A, "Where's Pete?" Best wishes in 2012 to all the forum regulars and newbies, Pete
|
Regards, Michael
|
*Hi, Pete - Happy New Year to you too!by (Login qb432l)R * |
My brother is a coach for the Southern High school junior varsity girls team at Deep Creek Maryland. He spends a ton of time working with them! Hope your team does well!
Ted |
Happy New Year to all! Revisited Times Square program:by Solitaire (no login)DECLARE SUB Ball (x AS INTEGER, y AS INTEGER, w AS INTEGER, tint() AS INTEGER) DECLARE SUB Pole () DIM x AS INTEGER, y AS INTEGER, w AS INTEGER, T AS SINGLE DIM yr AS INTEGER, mo AS INTEGER, cheer AS INTEGER DIM year AS STRING, month AS STRING, msg AS STRING, E AS STRING DIM tint(0 TO 20) AS INTEGER DIM song(1 TO 5) AS STRING RANDOMIZE TIMER year$ = RIGHT$(DATE$, 4) month$ = LEFT$(DATE$, 2) yr = VAL(year$) mo = VAL(month$) IF mo >= 9 THEN yr = yr + 1 year$ = LTRIM$(RTRIM$(STR$(yr))) year$ = SPACE$(4) + year$ + SPACE$(7) 'center interchange with message msg$ = "HAPPY NEW YEAR!" song$(1) = "p8mbmlO2T220" 'song - Auld Lang Syne song$(2) = "ccfffeffaagggfgg" song$(3) = "agffffaa>ccddddd" song$(4) = "p8ddccc<aaaffgggfgg" song$(5) = "agfffdddccfffff" CLS LOCATE 6, 22: PRINT "TIMES SQUARE ON NEW YEAR'S EVE" PRINT TAB(22); STRING$(30, "_") PRINT : PRINT , , "by Solitaire" LOCATE 19, 20: PRINT "Press Alt-Enter for a full screen." PRINT TAB(15); "Program will not work properly in a window." LOCATE 24, 24: PRINT "Press any key to begin..."; E$ = INPUT$(1) CLS FOR x = 0 TO 20 'changing colors of ball as it drops READ tint(x) 'assigned to array NEXT x CALL Pole x = 2 y = 10 w = 1 CALL Ball(x, y, w, tint()) w = 0 COLOR 7, 0 LOCATE 25, 1: PRINT "Press any key to begin countdown "; PRINT TAB(50); "Press Esc to stop"; E$ = INPUT$(1) IF E$ = CHR$(27) THEN CLS : SYSTEM LOCATE 25, 1: PRINT SPACE$(70); s = 260 COLOR 8 LOCATE 10, 12: PRINT "Goodbye..." LOCATE 10, 58: PRINT yr - 1 FOR x = 1 TO 20 ex$ = INKEY$ IF ex$ = CHR$(27) THEN 'Esc places ball on bottom CLS CALL Pole CALL Ball(20, 0, 0, tint()) COLOR 7, 0: : EXIT FOR END IF SOUND s, 10 'sound heard while ball is dropping s = s + 9 IF x MOD 2 = 0 THEN 'countdown from 10 to 1 y = y - 1 END IF CALL Ball(x, y, w, tint()) T = TIMER DO WHILE T + .5 >= TIMER AND T + .5 <= 86400: LOOP NEXT x IF ex$ <> CHR$(27) THEN COLOR 30, 0 LOCATE 10, 10 PRINT msg$ LOCATE 10, 55 PRINT year$ PLAY "P2" FOR i = 1 TO 5 'song - Auld Lang Syne PLAY song$(i) ex$ = INKEY$ IF ex$ = CHR$(27) THEN COLOR 7, 0: EXIT FOR NEXT i c = 16 END IF IF ex$ <> CHR$(27) THEN cheer = 120 FOR blink = 1 TO cheer 'will not execute if Esc was pressed ex$ = INKEY$ IF ex$ = CHR$(27) THEN COLOR 7, 0: EXIT FOR c = c + 1 IF c = 32 THEN c = 17 COLOR c, 0 IF blink > 110 THEN COLOR 30 'messages blink and switch places IF blink = 120 THEN COLOR 14 SELECT CASE blink CASE 1 TO 16, 33 TO 48, 65 TO 80, IS > 97 LOCATE 10, 10 PRINT msg$ LOCATE 10, 55 PRINT year$ CASE ELSE LOCATE 10, 10 PRINT year$ LOCATE 10, 55 PRINT msg$ END SELECT DO row = INT(21 * RND) + 2 'confetti fills the sky col = INT(75 * RND) + 3 'does not cover ball or pole LOOP WHILE row > 17 AND col > 34 AND col < 46 OR col = 40 tint = INT(15 * RND) + 1 confetti$ = CHR$(INT(6 * RND) + 1) LOCATE row, col COLOR tint, 0 IF blink > 105 THEN confetti$ = "*" 'last confetti stars remain blinking COLOR tint + 16, 0 END IF PRINT confetti$ T = TIMER DO WHILE T + .15 >= TIMER AND T + .15 <= 86400: LOOP NEXT blink COLOR 30 'blinking yellow LOCATE 10, 55: PRINT year$ 'covers any random confetti LOCATE 10, 10: PRINT msg$ IF ex$ = CHR$(27) THEN CLEAR 'stop song if Esc was pressed COLOR 7, 0 LOCATE 25, 3: PRINT "Press any key to end..."; LOCATE 25, 55: PRINT "By Solitaire"; E$ = INPUT$(1) CLS DATA 3,3,2,2,3,3,5,5,3,3,2,2,3,3,5,5,3,3,2,2,3,3,3 SYSTEM SUB Ball (x AS INTEGER, y AS INTEGER, w AS INTEGER, tint() AS INTEGER) STATIC T AS INTEGER IF x > 2 THEN 'clear top of ball LOCATE x - 1, 38 PRINT SPACE$(5) 'space prints background color END IF LOCATE x, 36: PRINT " " LOCATE x, 44: PRINT " " LOCATE x, 37: PRINT SPACE$(7) COLOR 6 IF x > 2 THEN 'redraw pole on top LOCATE x - 1, 40 PRINT CHR$(186) END IF COLOR tint(T) 'redraw descending ball with changing color IF x > 1 THEN LOCATE x, 38 PRINT CHR$(220); STRING$(3, CHR$(219)); CHR$(220) END IF FOR z = 1 TO 2 IF x = 1 THEN LOCATE x + z, 39 PRINT STRING$(3, CHR$(219)) ELSE LOCATE x + z, 36 IF z = 1 THEN PRINT CHR$(220); STRING$(7, CHR$(219)); CHR$(220) ELSE PRINT CHR$(223); STRING$(7, CHR$(219)); CHR$(223) END IF END IF NEXT z LOCATE x + 3, 38 IF x > 1 THEN PRINT CHR$(223); STRING$(3, CHR$(219)); CHR$(223) IF y = 10 THEN IF w = 1 THEN LOCATE 3, 38 ELSE LOCATE x + 2, 38 END IF ELSE LOCATE x + 1, 39 END IF COLOR 0, tint(T) 'background color of countdown number PRINT y; 'countdown number COLOR 7, 0 LOCATE 1, 32 PRINT "TIMES SQUARE BALL" IF x = 20 THEN LOCATE 21, 40 COLOR 30, tint(T) PRINT CHR$(1) 'happy face replaces countdown number LOCATE 22, 40 PRINT "*" END IF T = T + 1 'static counter END SUB SUB Pole COLOR 6 'color of pole FOR x = 2 TO 24 LOCATE x, 40 PRINT CHR$(186) NEXT x LOCATE 24 PRINT TAB(37); CHR$(201); STRING$(2, CHR$(205)); CHR$(202); STRING$(2, CHR$(205)); CHR$(187); END SUB |
*Thank-you Solitaire! Now I can officially begin 2012. All the best for the new year!by (Login qb432l)R * |
* Thanks, Bob. All the best to you!by Solitaire (no login) |
*HAPPY NEW YEAR TO EVERYBUDDY*by OPRESION (no login)******************* |