Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 35
» Latest member: coronaman
» Forum threads: 136
» Forum posts: 1,157

Full Statistics

Online Users
There are currently 36 online users.
» 0 Member(s) | 36 Guest(s)

Latest Threads
Xmas New Year
Forum: Suggestions
Last Post: 1micha.elok
3 hours ago
» Replies: 13
» Views: 2,939
Santa by Marcus
Forum: NaaLaa 6 Code
Last Post: johnno56
11-18-2024, 05:41 PM
» Replies: 7
» Views: 127
How to code efficiently
Forum: NaaLaa 7 Questions
Last Post: 1micha.elok
11-17-2024, 09:31 AM
» Replies: 4
» Views: 146
How to make a race track ...
Forum: NaaLaa 7 Questions
Last Post: kevin
11-10-2024, 04:02 PM
» Replies: 8
» Views: 373
Start of a silly Galaga s...
Forum: NaaLaa 7 Code
Last Post: johnno56
11-08-2024, 08:22 AM
» Replies: 3
» Views: 185
Theme Editor
Forum: Everything else
Last Post: johnno56
11-05-2024, 06:45 PM
» Replies: 2
» Views: 140
Scrolling Text
Forum: Everything else
Last Post: kevin
11-04-2024, 02:17 PM
» Replies: 10
» Views: 429
Naalaa origins
Forum: Everything else
Last Post: johnno56
10-25-2024, 07:21 AM
» Replies: 2
» Views: 264
Maze generation
Forum: NaaLaa 7 Code
Last Post: johnno56
10-23-2024, 09:05 AM
» Replies: 17
» Views: 1,493
Curious
Forum: Everything else
Last Post: Marcus
10-12-2024, 11:18 AM
» Replies: 12
» Views: 2,704

 
  Convert String to Number
Posted by: 1micha.elok - 08-20-2024, 04:02 AM - Forum: NaaLaa 7 Questions - Replies (3)

Hi Marcus,

I'm making a tiny karaoke machine, but I can't find a function to convert string to number and to syncronize song and lyrics.
Could you please advise me ?

Code:
    'TOBE...synchronize lyrics and timestamps
    clearscreen()
    set caret 10,10
    for i = 1 to j-2      
       
        'time1 = left(lyrics[i],2) 'take the first two digits number of lyrics[i]
        'convert time1 from string to number
        'if 'real time' = time1 then display lyrics
                                       
        wln mid(lyrics[i],3,80)
        wait 3000 'this line should be removed if lyrics and timestamps are synchronized
    next

Herewith the full code 
Code:
'==================================================================================
'                               T.I.N.Y  K.A.R.A.O.K.E
'
' Songs :
' 1. Nathan Evans - Wellerman (Sea Shanty)
'    https://www.youtube.com/watch?v=bNQSMTNSnUw
'
' DISCLAIMER
'    It is not intended for commercial use and not for sale                      
'    No person or entity associated with this game received payment   
'    or anything of value, or entered into any agreement,             
'    in connection with any game assets used in this game.
'
'    All trademarks and game assets are the property of their respective owners. 
'    While every effort is made to acknowledge their works,
'    some of the game assets used in in this tiny game may not have
'    clear name of the artist/author/creator/developer to be referred with.
'    It may not include all relevant facts or the most up-to-date information.
'
'==================================================================================


'-----------------
' INITIALIZATION
'-----------------
set window "Karaoke",500,225,false,2

' color definition
visible black   = [0,0,0]
visible white   = [255,255,255]

' table to store lyrics line by line
lyrics = []


'-----------
' MAIN LOOP
'-----------
do
    clearscreen()

    'karaoke menu
    set caret 10,10
    wln "Karaoke"
    wln "* Choose music file (wav)"
    wln "* Choose lyric file (txt)"
    wln
    wln "Press SPACE to continue or ESC to quit"
    do
        if keydown(KEY_ESCAPE,true) then end
        wait 1
    until keydown(KEY_SPACE,true)
   
    'loop until filename is not blank
    do
        filemusic  = openfiledialog("wav")
        filelyrics = openfiledialog("txt")
    until not filemusic="" and not filelyrics=""

    'loop until ready
    loopready("Are you ready",14)

    'read lyrics from text file line by line
    f = openfile(filelyrics)
    j = 1
    do
        lyrics[j] = frln(f)
        j = j + 1
    until frln(f) = unset
    free file f

    'load and play music
    load music 1,filemusic
    play music 1

    'TOBE...synchronize lyrics and timestamps
    clearscreen()
    set caret 10,10
    for i = 1 to j-2      
       
        'time1 = left(lyrics[i],2) 'take the first two digits number of lyrics[i]
        'convert time1 from string to number
        'if 'real time' = time1 then display lyrics
                                       
        wln mid(lyrics[i],3,80)
        wait 3000 'this line should be removed if lyrics and timestamps are synchronized
    next

    'loop until ready
    loopready("Next Song ",14)
    free music 1
loop


'-----------
' FUNCTIONS
'-----------
function clearscreen()
    set color black;cls;set color white
endfunc

function loopready(message,lineNum)
    do
        'clear inside a defined rectangle
        set color black
        draw rect 10,lineNum*15,300,15,1
   
        'continue ?
        set color white
        set caret 10,lineNum*15
        write message+" (Y/N) ?"
        answer = rln()
        if upper(answer)="N" then end
    until upper(answer)="Y"
endfunc



Attached Files
.zip   Karaoke.zip (Size: 188.81 KB / Downloads: 4)
Print this item

  LowResJam
Posted by: Marcus - 07-31-2024, 08:58 PM - Forum: Programming - Replies (6)

Here's a game jam that seems kind of fun: https://itch.io/jam/lowrezjam-2024 . It starts tomorrow.

Print this item

  Neon Breath
Posted by: Marcus - 07-30-2024, 10:28 AM - Forum: NaaLaa 7 Code - Replies (8)

This is my submission for the Jam for All BASIC Dialects (#6) (https://itch.io/jam/jam-for-all-basic-dialects-6). There are only two levels, are they easy or hard? I just can't tell.

Edit It requires the latest version of n7 (released today) if you want to re-compile it.



Attached Files
.zip   neon_breath.zip (Size: 9.78 MB / Downloads: 14)
Print this item

  N7 version 24.07.30 released
Posted by: Marcus - 07-30-2024, 09:33 AM - Forum: Announcements - Replies (5)

Just some small fixes.

https://naalaa.com/n7/N7_240730.zip

2024-07-30

  • s3d: Fixed a bug in S3D_BlendMesh
  • s3d: Added the S3D_SetPerspectiveCorrection function
  • enginea: Fixed a bug that made the jump height of the EA_FpsPlayer object dependant on the frame rate
  • Fixed a bug (crash) in the enginea editor

Print this item

  Star Trek
Posted by: 1micha.elok - 07-23-2024, 11:14 AM - Forum: NaaLaa 7 Code - Replies (17)

       
click each image to zoom-in

================================
STAR TREK N7
simplified and modified version

Inspired by the 1970s Star Trek
by Mike Mayfield and Bob Leedom
================================

Code:
'Initial Message
set caret 10,20
set color black; cls;set color white
wln "     ______ _______ ______ ______   _______ ______  ______ __ __  "
wln "    / __  //__  __// __  // __  /  /__  __// __  / / ____// // /® "
wln "   / / /_/   / /  / /_/ // /_/ /     / /  / /_/ / / /__  / // /   "
wln "  __\ \     / /  / __  //   __/     / /  /   __/ / __ / /    /    "
wln " / /_/ /   / /  / / / // /\ \      / /  / /\ \  / /___ / /\ \     "
wln "/_____/   /_/  /_/ /_//_/  \_\    /_/  /_/  \_\/_____//_/  \_\    "
wln
wln " YOU ARE THE CAPTAIN OF THE STARSHIP ENTERPRISE"
wln " SEEK AND DESTROY THE KLINGONS"
wln " THEY ARE MENACING THE UNITED FEDERATIONS OF PLANETS"


Coming Soon !

Big Grin Big Grin Big Grin

Note :
   
Will Mr.Spock as Captain Kirk's second-in-command accept the Klingon's challenges ?

Print this item

  Question about snake game
Posted by: aliensoldier - 07-19-2024, 05:48 PM - Forum: NaaLaa 7 Questions - Replies (11)

I have a question about the snake game. The snake's body is divided into small pieces and they follow the head. How can I make the pieces that make up the body follow the head of the snake when I move it?

Print this item

Big Grin Windows Program Console
Posted by: dantas72 - 07-14-2024, 09:39 PM - Forum: NaaLaa 7 Questions - Replies (2)

What's up guys! Can we have examples of practical use of codes for the Windows console?

1 - Search.
2 - create directory.
3 - A program to receive two numbers from the user and make the sum and display it on the screen.
4 - Remove directories.
5 - Search within files, .txt, Doc.
6 - Basic Mini Compiler.
7 - Receive arguments via the prompt command line.

Something to learn more about the language.
thanks Smile

Print this item

  Animated String Art
Posted by: johnno56 - 07-11-2024, 08:36 PM - Forum: NaaLaa 7 Code - Replies (4)

Not sure if I had posted this before... If I have, let me know, and I will delete it... lol

This is a converted QB64 demo created by BPlus... 

If you are as old or older than I am then this will be a "flash back"... If you are young, then stare continuously at the rotating pattern, then transfer all your savings to the following account number... Moo Ha Ha Ha Ha....

Variable "t" on line #41 will determine the number of "points" to be drawn. The program will start with one point and increment by one until "t" is reached. Then it starts over again using a different colour... ESC to quit.

Code:
' Open a window and enable double buffering.
set window "String Art Animated", 600, 600, false
set redraw off

'   Converted from a QB64 program by BPlus

randomize clock()

visible xmax = 600
visible ymax = 600
visible a1, a2, cx, cy, r, s, n, pi, t
visible red, blue, green

r = ymax / 2
cx = xmax / 2
cy = ymax / 2
n = 250
s = 360 / n

red = 175
green = 255
blue = 255

pi = 3.141592654

t = 1

do
    set color 0, 0, 0
    cls
    'set color red, green, blue
    draw ellipse cx - 1, cy, r, r
    for i = 1 to n
        a1 = s * i
        a2 = s * i * t
        set color red, green , blue
        draw line cx + sin(d2r(a1)) * r, cy + cos(d2r(a1)) * r, cx + sin(d2r(a2)) * r, cy + cos(d2r(a2)) * r
    next
   
    t = t + 0.0125
    if t >= 20
        t = 1
        red = 32 + rnd(33, 255)
        green = 32 + rnd(33, 255)
        blue = 32 + rnd(33, 255)
    endif

    redraw
    fwait 60   
until keydown(KEY_ESCAPE, true)

'   -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
function d2r(angle)
    return angle * (pi / 180)
endfunc
'   -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Print this item

  out in memory in Malloc ,new version
Posted by: oskarg - 07-03-2024, 08:35 AM - Forum: NaaLaa 7 Questions - Replies (5)

Good morning, when I was compiling the base examples I got this :
   
Since I can solve the problem, it doesn't allow me to run Naalaa now.

Print this item

  N7 version 24.06.29 released
Posted by: Marcus - 06-29-2024, 03:31 PM - Forum: Announcements - Replies (3)

This release contains a first version of the enginea library, meant for sector based first person shooter games. This is far from the final version of the library; support for meshes is very basic and has not been tested much.

https://naalaa.com/n7/N7_240629.zip

2024-06-29

  • Added the enginea library and editor (enginea_editor.exe), for sector based first person shooter games, plus a tutorial (EngineA_Tutorial.pdf) and examples in examples/enginea_library

Print this item