Author Topic: I need help with a script  (Read 745 times)

I was messing around on FreeBasic, and it was working fine untill i tried adding a new sub "helloworld" (At the bottom of the code)
-This has nothing to do with Blockland :3-
So if you guys can help me out so i can get this to work thanks.
Code: [Select]
declare sub main
declare sub add
declare sub subtract
declare sub multiply
declare sub divide
declare sub calc
declare sub helloworld

main
sub main
    cls
    print "-Main Menu-"
    dim choice1
    print "1. Calculator"
    print "2. Hello"
    input choice1
    if choice1 = 1 then
        calc
    if choice1 = 2 then
        helloworld
    else
        main
    end if
end sub


sub calc
    cls
    print "-Calculator-"
    dim choice1
    print "1. Add"
    print "2. Subtract"
    print "3. Multiply"
    print "4. Divide"
    input choice1
    if choice1 = 1 then
        add
    elseif choice1 = 2 then
        subtract
    elseif choice1 = 3 then
        multiply
    elseif choice1 = 4 then
        divide
    else
        main
    end if
end sub


sub add
    cls
    print "-Add-"
    dim num1
    dim num2
    dim answer1
    input num1
    input num2
    answer1 = num1 + num2
    print answer1
    sleep
    main
end sub


sub subtract
    cls
    print "-Subtract-"
    dim num1
    dim num2
    dim answer1
    input num1
    input num2
    answer1 = num1 - num2
    print answer1
    sleep
    main
end sub


sub multiply
    cls
    print "-Multiply-"
    dim num1
    dim num2
    dim answer1
    input num1
    input num2
    answer1 = num1 * num2
    print answer1
    sleep
    main
end sub


sub divide
    cls
    print "-Divide-"
    dim num1
    dim num2
    dim answer1
    input num1
    input num2
    answer1 = num1 / num2
    print answer1
    sleep
    main
end sub

sub helloworld
    cls
    print "-Hello World-"
    dim word1 as string
    input "Say hello!" ; word1
    if number = Hello then
        print "Ohia there!"
    sleep
    main
end sub

well based on whats already working -- I think you need somethign like this:
Code: [Select]
sub helloworld
    cls
    print "-Hello World-"
    dim word1 as string
    input "Say hello!" ; word1
    if number = Hello then
        print "Ohia there!"
    end if
    sleep
    main
end sub

I dont know freebasic - so that could be totally wrong

-This has nothing to do with Blockland :3-
Then if goes in off topic.
Or possibly Creativity.
You'd get more help there, also.

Then it goes in off topic.
Or possibly Creativity.
You'd get more help there, also.