
-----------------------------------
TylerL
Wed Jun 07, 2006 11:58 am

Paint/Write Code (hard to explain!)
-----------------------------------
This program lets you draw lines in Turing and have the code written out for you in a text file.

View.Set ("graphics")
Mouse.ButtonChoose ("multibutton")

% Hold L to draw a line. To stop drawing a line, right click while holding L.
% You must create code.txt in the same directory as this file before using
% this program. Clear the code.txt file before using again.

var x, y, button, right, lastx, lasty, counter : int

var filename : string := "code.txt"
var filenumber : int

var drawline1 : string := "drawline("
var comma : string := ", "
var drawline2 : string := ", black)"

var stringx : string
var thisvar : string

var keydown : array char of boolean

counter := 0
right := 100

open : filenumber, filename, put

loop

    loop
    
        Input.KeyDown (keydown)
        
        if keydown ('l') then
        
        delay (75)

        Mouse.Where (x, y, button)

        if button = 1 and counter = 0 then

            lastx := x
            lasty := y

            counter := 1

        elsif button = 1 then

                put : filenumber, drawline1 ..
                put : filenumber, lastx ..
                put : filenumber, comma .. 
                put : filenumber, lasty ..
                put : filenumber, comma .. 
                put : filenumber, x ..
                put : filenumber, comma .. 
                put : filenumber, y ..
                put : filenumber, drawline2

            drawline (lastx, lasty, x, y, black)

            lastx := x
            lasty := y


        end if

        exit when button = 100
        
        end if
        
        
    end loop


    counter := 0
    lastx := 0
    lasty := 0

end loop
close : filenumber


Enjoy!

-----------------------------------
CodeMonkey2000
Wed Jun 07, 2006 2:23 pm


-----------------------------------
not bad

var x, y, button : int
var c:int:=10
var keydown : array char of boolean 

loop
Input.KeyDown (keydown) 
        
        if keydown ('c') then 
cls
elsif keydown ('v') then
randint (c,1,255)
end if
    Mouse.Where (x, y, button)
    if button = 0 then

    else
        drawfilloval (x, y , 5, 5, c)
    end if
end loop


-----------------------------------
Clayton
Wed Jun 07, 2006 2:51 pm


-----------------------------------
@spearmonkey2000 : your above post is spam, plz refrain from doing so in the future :D

now as for the program TylerL, not bad but believe me, this is not the first of its kind, keep working on it using new ideas, check the Turing Walkthrough for anything new and start learning new things :D

-----------------------------------
upthescale
Wed Jun 07, 2006 3:00 pm


-----------------------------------
super freak why do u talk, u always spam and double post, u haven o right to say, cuz i do mistakes to so i kleep my motuh shut

-----------------------------------
iker
Wed Jun 07, 2006 3:23 pm


-----------------------------------
super freak why do u talk, u always spam and double post, u haven o right to say, cuz i do mistakes to so i kleep my motuh shut
upthescale, you're realy starting to get anoying and ridiculous. People change over time, just because super freak may have spammed/double posted before, it doesn't mean he didn't learn from those mistakes, unlike some people (mainly you) who keep on spamming even after being told not to.

-----------------------------------
_justin_
Wed Jun 07, 2006 10:48 pm


-----------------------------------
eh thats a rather useful program when it comes to drawing line 

you should add a feature where you can select a color for the line to be 

but anywho good job :dance:
