
-----------------------------------
Homer_simpson
Thu May 08, 2003 8:28 pm

Useful Functions and procedures...
-----------------------------------
Ok all the programming masters submit your useful procedures and functions here.....

-----------------------------------
Homer_simpson
Thu May 08, 2003 8:38 pm


-----------------------------------
Homer's first function submittion:

Ever wanted to have one command delayed in a loop and not stop other commands from running here's the function u need

function timedelay (var r : int, t : int) : boolean
    var tt : int
    clock (tt)
    if r = 0 then
    clock(r)
    result false
    end if
    if tt - r >= t then
        r := tt
        result true
    else
        result false
    end if
end timedelay

and here's an example of it in use
View.Set ("offscreenonly")
var time1, i, r : int := 0


loop
    if timedelay (time1, 1000) then
        i += 1
        % the rest of program is going on while the commands in this loop only work once every second
    end if

    r += 10
    drawfillarc (320, 200, 150, 150, r, r + 10, 9)
    locate (1, 1)
    put i, " seconds"
    View.Update
    cls
end loop


-----------------------------------
Catalyst
Thu May 08, 2003 9:28 pm


-----------------------------------
i hav a library i compiled of useful fucntion/procs a while ago so i wouldnt have to hunt for them (note: not all are made by me)

Ive got this posted in submissions since there is no attachments in source :(

MOD EDIT: I attached the file, and I'm see if I can let users attach files over here - Tony

-----------------------------------
Homer_simpson
Thu May 08, 2003 9:36 pm


-----------------------------------
wow cool functions but why didn't u send them here as an attachment?

-----------------------------------
Catalyst
Thu May 08, 2003 9:38 pm


-----------------------------------
doesnt let you put attachments in source/tutorials

-----------------------------------
Homer_simpson
Thu May 08, 2003 10:16 pm


-----------------------------------
Doh!!! i am so very stupid... =(
Thx tony...
