Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How To Make Loop on This Program
Index -> Programming, Turing -> Turing Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Raknarg




PostPosted: Mon May 02, 2011 8:13 pm   Post subject: RE:How To Make Loop on This Program

if counter = 200
Try changing that.
Sponsor
Sponsor
Sponsor
sponsor
darkage43




PostPosted: Mon May 02, 2011 8:26 pm   Post subject: RE:How To Make Loop on This Program

I changed the counter=200 to a much greater value but the message is still flashing at the same rate as before.
Raknarg




PostPosted: Mon May 02, 2011 8:28 pm   Post subject: RE:How To Make Loop on This Program

Show me your new code.
darkage43




PostPosted: Mon May 02, 2011 8:29 pm   Post subject: RE:How To Make Loop on This Program

%Adds the ability to use GUI in this program
import GUI

%Declaring all variables used in the program
var counter : int := 0
var integer := 1
var winID := Window.Open ("graphics:800;800")
var message : string
var font1 : int

put "Enter your message here please: " ..
get message
put " "
put "Click quit to exit the program"

font1 := Font.New ("times:50")

loop
for i:0..16
colour (integer)
Font.Draw (message, 350, 425, font1, i)
counter += 1
if counter = 1000 then
integer += 1
counter := 0
end if

var quitBtn : int := GUI.CreateButton (375, 100, 0, "Quit", GUI.Quit)
end for
exit when GUI.ProcessEvent
end loop

Window.Close (winID)
Raknarg




PostPosted: Mon May 02, 2011 8:35 pm   Post subject: RE:How To Make Loop on This Program

Its because you set the color of Font.Draw to i, not integer. Why do you have that for loop?
darkage43




PostPosted: Mon May 02, 2011 8:40 pm   Post subject: RE:How To Make Loop on This Program

If I change Font.Draw into integer, the program wouldn't flash the text in the specified colours.
Raknarg




PostPosted: Mon May 02, 2011 8:41 pm   Post subject: RE:How To Make Loop on This Program

Well, then do the same thing you did with the counter. When it hits 17, reset it.
darkage43




PostPosted: Mon May 02, 2011 8:49 pm   Post subject: RE:How To Make Loop on This Program

How do I reset it? I'm really new to turing.
Sponsor
Sponsor
Sponsor
sponsor
Raknarg




PostPosted: Mon May 02, 2011 8:52 pm   Post subject: RE:How To Make Loop on This Program

lol, ok then Razz
So you do the same thing you did with the counter. When counter = 200, you set it back to zero. What you can do with integer is set it to zero after it reaches 17. That way you'll only get the colors 1 - 16 instead of it continuing on.
darkage43




PostPosted: Mon May 02, 2011 9:01 pm   Post subject: RE:How To Make Loop on This Program

How do I set my counter to 0 once it hits 17?
darkage43




PostPosted: Mon May 02, 2011 10:45 pm   Post subject: RE:How To Make Loop on This Program

K I've finally figured it out. Thank you so much Raknarg for being so helpful.
Raknarg




PostPosted: Tue May 03, 2011 9:19 am   Post subject: RE:How To Make Loop on This Program

No problem.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 2  [ 27 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: