
-----------------------------------
Velocity
Mon Nov 28, 2011 5:05 pm

im having a syntax error (please run the program and you will see it.
-----------------------------------


var player1, player2, play1, gender1, gender2 : string
var word1, word2, word3, word4, word5 : int
var stream : int
var wordList : flexible array 1 .. 20 of string
var declare : int
var choices : string
var p1, p2 : string
var first, second : string
View.Set ("graphics:700;800")

%
procedure torso
    drawfillbox (300, 350, 350, 540, 121)
end torso
%
procedure head
    drawfilloval (325, 600, 60, 70, 48)
end head
%still working on finishing
procedure rightArm
    %drawfillbox (,91)
end rightArm
%till here, and the rest of the body parts
procedure choice1
    var choice : string (1)
    locate (30, 10)
    put "Press any key to continue..."
    getch (choice)
    cls
end choice1
%

procedure playgame
    colorback (91)
    color (48)
    cls
    if gender1 = "m" or gender1 = "M" then
        put "Welcome to the game Mr. ", player1
    elsif gender1 = "f" or gender1 = "F" then
        put "Welcome to the game Ms. ", player1
    end if
    %
    if gender2 = "m" or gender2 = "M" then
        put "Welcome to the game Mr. ", player2
    elsif gender2 = "f" or gender2 = "F" then
        put "Welcome to the game Ms. ", player2
    end if
    %
    open : stream, "WordList.txt", get
    loop
        exit when eof (stream)
        get : stream, wordList (upper (wordList))
        new wordList, upper (wordList) + 1
    end loop
    %
    put "The computer is now generating your word."
    declare := Rand.Int (1, 20)
    put wordList (declare)
    put "Who will be choosing a letter first? 

Please specify what version of Turing you are using
4.1.1a

It says it the variable has no value + bits to answerer/helper asap please and karma!

-----------------------------------
Velocity
Mon Nov 28, 2011 5:41 pm

RE:im having a syntax error (please run the program and you will see it.
-----------------------------------
anyone?? please. still want to know.

-----------------------------------
Insectoid
Mon Nov 28, 2011 5:45 pm

RE:im having a syntax error (please run the program and you will see it.
-----------------------------------
It says it the variable has no value

Well, there's your problem. Turing told you what you did wrong. Try reading the error messages and figuring out what they mean. 

Also, this isn't a syntax error. It's a logic error.

-----------------------------------
Aange10
Mon Nov 28, 2011 5:45 pm

RE:im having a syntax error (please run the program and you will see it.
-----------------------------------
You forgot the part where you tell us what you've tried.

-----------------------------------
ttm
Mon Nov 28, 2011 6:57 pm

Re: im having a syntax error (please run the program and you will see it.
-----------------------------------
I believe it's because your wordList array already has an initial size of 20, but when you read new values, you increase its size. Try changing line 4 of your program to read:

[code]
var wordList : flexible array 1 .. 1 of string 
[/code]

-----------------------------------
ttm
Mon Nov 28, 2011 7:03 pm

Re: im having a syntax error (please run the program and you will see it.
-----------------------------------
Also, you forgot to set values for your first and second variables. From the looks of it, you can set them to pretty much anything.

[code]
var first : string := "aoeuidhtns-"
var second : string := "etaoinshrdlcu"
[/code]

-----------------------------------
Velocity
Tue Nov 29, 2011 12:01 pm

RE:im having a syntax error (please run the program and you will see it.
-----------------------------------
ttm you gave me the best answer ever!!! Thank you so much! I love you.

-----------------------------------
Raknarg
Tue Nov 29, 2011 12:47 pm

RE:im having a syntax error (please run the program and you will see it.
-----------------------------------
I think it still make make it a problem if the wordList is 1 .. 1, try changing it to 1 .. 0 (aka an array with no elements to begin with)

-----------------------------------
ttm
Tue Nov 29, 2011 4:12 pm

Re: im having a syntax error (please run the program and you will see it.
-----------------------------------
Nope. In his code, he assigns before expanding the array, so there must be 1 blank spot first. See:

[code]
    loop 
        exit when eof (stream) 
        get : stream, wordList (upper (wordList)) 
        new wordList, upper (wordList) + 1 
    end loop 
[/code]

-----------------------------------
Raknarg
Tue Nov 29, 2011 5:28 pm

RE:im having a syntax error (please run the program and you will see it.
-----------------------------------
Why doesnt he resize it first and then assign it? He probably shouldnt have more elements than he's going to use.

-----------------------------------
ttm
Tue Nov 29, 2011 5:42 pm

Re: im having a syntax error (please run the program and you will see it.
-----------------------------------
1 extra element isn't going to make a difference.

Also no @Velocity, no prob :P

-----------------------------------
Velocity
Wed Nov 30, 2011 11:25 am

RE:im having a syntax error (please run the program and you will see it.
-----------------------------------
@ttm :)
@raknarg i want to add the fact to allow the user to choose a letter in the word and if they get it right it pops up in a blank line of the word, like any other hangman game, how would i go about doing this?

-----------------------------------
Dragon20942
Wed Nov 30, 2011 1:14 pm

RE:im having a syntax error (please run the program and you will see it.
-----------------------------------
Use an array to store each letter of the word, then check if any of the indexes are the guessed letter using a for loop.

-----------------------------------
Velocity
Wed Nov 30, 2011 10:57 pm

RE:im having a syntax error (please run the program and you will see it.
-----------------------------------
what do you mean by "check if any of the indexes are the guessed letter" - how would i go about donig that?

-----------------------------------
Aange10
Wed Nov 30, 2011 11:25 pm

Re: RE:im having a syntax error (please run the program and you will see it.
-----------------------------------
what do you mean by "check if any of the indexes are the guessed letter" - how would i go about donig that?

[code]
if index = guessedLetter then
end if
[/code]

-----------------------------------
Dragon20942
Fri Dec 02, 2011 12:37 pm

RE:im having a syntax error (please run the program and you will see it.
-----------------------------------
Read about arrays. An index of an array is the value in brackets after the array name which specifies what value in the array you are calling.
