|
Post by anton2012 on Feb 14, 2024 17:55:47 GMT
1st is there a WAIT comand?like what is i want to print a word and then i want to wait 5 seconds? 2nd is there a RNG comand like to pick a random number?
|
|
|
Post by tsh73 on Feb 14, 2024 19:16:16 GMT
1) there is a WAIT instructuin but it does different thing You can use user defined function Just be warned that making user wait seconds until something will happen will not add you any friends.
'busy loop delay demo read dt while dt>0 SCAN 'allow to break the loop, like closing window (!!!) print "Delay for ";dt;"ms... "; call delay dt print "Done!" read dt 'next one wend
print print "-- over --" end
'--------------------------------- sub delay ms t=time$("ms")+ms while t>time$("ms") scan 'do nothing, but allow to break the loop wend end sub
data 10 data 50 data 100 data 200 data 500 data 1000 data 3000 data -1
2)
print "random number (0..1)",rnd(1) print "another random number ",rnd(1) print "now seed RND generator so each run will be same numbers" randomize .5 '0..1 print "random number (0..1)",rnd(1) print "another random number ",rnd(1) print "Try to run program several times." print "first 2 numbers will be different" print "second 2 will be the same on each run" print "5 random numbers, scaled /rounded to" print print "no scale", "0..9", "0..9 ints", "-5..4 integers" for i = 1 to 5 r=rnd(1) print r, r*10, int(r*10), -5+int(r*10) next
|
|
|
Post by honky on Feb 15, 2024 12:02:58 GMT
Print a word gosub [pause] Print an other word wait
[pause] timer 5000, [temps] 'or timer temp wait [temps] timer 0 return
|
|
|
Post by anton2012 on Feb 16, 2024 17:28:37 GMT
how to play sounds?like i want to add some music to my game! plus how to add some pictures(sprytes)to my game i just want to add some pop to my game! edit:how to color text and the backround when you run the game
|
|
|
Post by Rod on Feb 16, 2024 18:54:34 GMT
Playwave and playmidi are the commands that play sound. For a text adventure you might just as well display bitmap images. Moving sprites can be done but it creates an animation which is harder to mesh with a text adventure.
|
|
|
Post by anton2012 on Feb 16, 2024 18:55:28 GMT
wow thanks!
|
|
|
Post by anton2012 on Feb 16, 2024 20:33:00 GMT
WAIT how to display a bitmap images??
|
|
|
Post by Rod on Feb 17, 2024 7:30:07 GMT
|
|
|
Post by anton2012 on Feb 17, 2024 7:43:28 GMT
thanks!
|
|
|
Post by anton2012 on Feb 17, 2024 12:41:45 GMT
what is a "index: 90139 is outside of collection bounds" error message
|
|
|
Post by tsh73 on Feb 17, 2024 13:30:05 GMT
Obviously you are doing something wrong. But it really hard to guess what Without code posted.
|
|
|
Post by anton2012 on Feb 17, 2024 13:32:48 GMT
ThankYouVar=99999 PRINT "THANK YOU,DAD!" PRINT "THANK YOU MENU:" PRINT "1.THANK YOU!" PRINT "2.COOL MUSIC" PRINT "3.SLIME PUP EMOJIS(no work)" PRINT "4.NUCLEAR THANK YOU" DO INPUT "choose a thank you: "; choice SELECT CASE choice CASE 1 GOSUB 300 CASE 2 GOSUB 310 CASE 3 GOSUB 320 CASE 4 GOSUB 330 CASE 0 END CASE ELSE PRINT "Invalid thank you,please choose the thank you." END SELECT LOOP UNTIL TRUE END 300 REM Entry for Azure PRINT "thanks to you:" PRINT "i know how to code!" PRINT "this is the first demo contaning sound and music btw" PRINT "so comeon sheck out option 2 and 3!" RETURN 310 REM PRINT "1.Slumber Party" PRINT "2. Jams" PRINT "3.Jams VIP" PRINT "4.No More Entities" PRINT "5.Updated N Upraded" PRINT "6.Transit" PRINT "7.Who's hungry?" DO INPUT "choose music: "; choice SELECT CASE choice CASE 1 GOSUB 100 CASE 2 GOSUB 110 CASE 3 GOSUB 120 CASE 4 GOSUB 130 CASE 5 GOSUB 140 CASE 6 GOSUB 150 CASE 7 GOSUB 160 CASE 0 CASE ELSE PRINT "Invalid music you,please choose the music." END SELECT LOOP UNTIL TRUE 100 REM PRINT "PLAYING MUSIC" PLAYWAVE "C:\Users\Anton\Downloads\compressed\Fishcracks - Slumber Party (Kaiju Paradise OST) (256 kbps) (1).wav" PRINT "STOPING MUSIC" RETURN 110 REM PRINT "PLAYING MUSIC" PLAYWAVE "C:\Users\Anton\Downloads\compressed\Fishcracks - JAMS (Kaiju Paradise OST) (256 kbps).wav" PRINT "STOPING MUSIC" RETURN 120 REM PRINT "PLAYING MUSIC" PLAYWAVE "C:\Users\Anton\Downloads\compressed\Fishcracks - JAMS (VIP) (Kaiju Paradise OST) (256 kbps).wav" PRINT "STOPING MUSIC" RETURN 130 REM PRINT "PLAYING MUSIC" PLAYWAVE "C:\Users\Anton\Downloads\compressed\Fishcracks - Updated N Upgraded (Kaiju Paradise OST) (256 kbps).wav" PRINT "STOPING MUSIC" RETURN 140 REM PRINT "PLAYING MUSIC" PLAYWAVE "C:\Users\Anton\Downloads\compressed\Fishcracks - Transit (Kaiju Paradise OST) (256 kbps) (1).wav" PRINT "STOPING MUSIC" RETURN 150 REM PRINT "PLAYING MUSIC" PLAYWAVE "C:\Users\Anton\Downloads\compressed\Fishcracks - Whos Hungry_ (Kaiju Paradise OST) (256 kbps) (1).wav" PRINT "STOPING MUSIC" RETURN 330 REM PRINT "1.YEZ!" PRINT "2.no" INPUT "are you sure??this could destroy your PC!: "; choice SELECT CASE choice CASE 1 GOSUB 200 CASE 2 GOSUB 210 CASE ELSE PRINT "bro i think you missed the point." END SELECT end 200 REM DO PRINT "THANK YOU,DAD!" LOOP UNTIL TRUE RETURN 210 REM end 320 REM LOADBMP "bg", "bg.bmp" RETURN
|
|
|
Post by tsh73 on Feb 17, 2024 18:53:34 GMT
Run your program via menu Run\Lite Debug This way, the error happens, debug window will be opened and line with error will be highlighted
I managed to get similar error on LOADBMP
So Just BASIC does not like your BMP file To make sure, just re-save it via Windows Paint as 24 bit BMP
|
|
|
Post by tsh73 on Feb 17, 2024 19:08:51 GMT
The question "how to display a bitmap images??" has no right and easy answer Basically, to show picture, you need a window some easy way would be LOADBMP LOADBMP "bg", "bg.bmp" open "your_title" for graphics_nsb_nf as #gr #gr "down" #gr "drawbmp bmp 0 0" #gr "flush" 'so your picture will not desappear if you move over window above it
but this is not quite right * Window needs to be closed, so it needs trapclose command (or program will complain on close about window #gr) * default graphics_nsb_nf is somewhat 320x370 pixels. If you know your bitmap size, you should set WindowWidth WindowHeight before opening window. If you do not know beforehand, there is code that read size from bitmap file * This method does not scale bitmap. If it is too big, you will see only top left corner See? No "right and easy". All could be taken care of, but it going to get complicated... (btw, there is 2 more ways to show bitmap 1) Using sprite engine (read Help on Sprites) and set loaded bitmap as background. This way picture will be scaled up 2) Using BMPBUTTON With some tricks it could be scaled any way, up or down Have a look here justbasiccom.proboards.com/thread/1042/using-bmpbutton-scale-bitmapsEDIT there is 0-option Just let Windows handle all this run "explorer.exe ";"bg.bmp" But for me it opens bitmap in Paint - not exactly thing I would like then I want to *show* bitmap
|
|
|
Post by anton2012 on Feb 19, 2024 13:23:11 GMT
thanks!
|
|