help!

new topic     » goto parent     » topic index » view thread      » older message » newer message

I have been working all night trying to define a global sequence
that changes a variable.
        The first time I tried a global anything many months ago,  It didn't
work, so I gave up and concentrated on other things.
        Now I am working with Rob Craig's sched.e, and have written a global
procedure intended to check the keyboard and change a variable or two,
I can get the procedure to run,  but not to actually change the variable.
        It will recognize a key is pressed,  print the key number, print
"hi" etc,  but will not act on the keypress.
        I have tried the abort(1),  a puts statement,  none of them work
inside of the elsif.
        The procedure is as follows,  any help?  The global function I tried
failed totally, so I am concentrating on global procedure first, since that
was what Rob had in there to begin with.

Start of io.e
------------------------------------------------------------

--try subtracting something
procedure subtract()
                lemx = lemx - 5
    puts(1,"hi")
end procedure



--main
global procedure task_keyb()
a = 1
a=a+1
while 1 do
    key = get_key()
         if key != -1 then



         ?key

         elsif key = 27 then
            --what to do if esc pressed
                gameover = TRUE
         elsif key = 331 then
            --what to do if left arrow
         subtract()--tried to use an in include procedure, it didn't work ither.
         elsif key = 333 then
            --what to do if right arrow
                lemx = lemx + 5
                ?lemx
         elsif key = 336 then
                lemy = lemy + 5
            --down arrow
         elsif key = 328 then
                lemy = lemy - 5
            --up arrow
         end if

        G_lempos = {lemx,lemy}

        exit
    end while
    --return G_lempos
    --return G_lempos--a variable to return to ???
end procedure

--end.

I have G_lempos as a global sequence, lemx and lemy as global atoms, all
defined in a global var.e file and made lemx and lemy = to a global constant
defined in the included variable file.
let lemx and lemy be equal to that constant right before the main procedure
in my main ex program, which I don't think has anything to do with this
part,  it is only the timing and scheduling stuff which has been made to
call only this global procedure so far.

        Anything else I can send, but can't understand why it will print an
amount, but not modify a variable.
        Anybody able to help???
Please....??????
Thanks Monty

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu