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

Username:   Password: 
 RegisterRegister   
 Scrolling text
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Hack.saw




PostPosted: Wed Jun 14, 2006 9:48 am   Post subject: Scrolling text

hmmm... just learned how to use the Window.Whatever comands and thought they would be perfect for lets say... mission briefings. Is there any reletively easy way to get the letters to apear on the screen one at a time until the full sentance is shown? (looked in tutorials but couldnt quite find what i wanted, mabe skipped over it on acc Confused )
Sponsor
Sponsor
Sponsor
sponsor
neufelni




PostPosted: Wed Jun 14, 2006 10:53 am   Post subject: (No subject)

Here is a simple way to make the sentance appear one word at a time:
code:

var sentance : string := "This text should appear one word at a time."

for i : 1 .. length (sentance)
    put sentance (i) ..
    if sentance(i) = " "
        delay (500)
    end if
end for


Here is a way to make the sentance appear one letter at a time, which I think would look better for mission briefing.
code:

var sentance : string := "This text should appear one letter at a time."

for i : 1 .. length (sentance)
    put sentance (i) ..
    delay (100)
end for
Hack.saw




PostPosted: Wed Jun 14, 2006 11:21 am   Post subject: (No subject)

Wow...so simple, cant believe i couldnt figure that out, lol. Thanks for the help Very Happy Now is there anyway to get that little flashing box that apears after the letters as thay are coming out or would you justhave to do that by making a box that flashes black/white one ahead of he text?
Bored




PostPosted: Wed Jun 14, 2006 1:08 pm   Post subject: (No subject)

Well that would be something you yourself would have to draw as unless waiting for input from the user the cursor does not appear. I'm almost certain there is no way to make it appear that is easy and dosen't require the use to input anything.
Clayton




PostPosted: Wed Jun 14, 2006 5:13 pm   Post subject: (No subject)

use View.Set("nocursor"), if you are having trouble with View.Set look in the Turing Walkthrough at my View.Set tut, where it is all explained Very Happy
Hack.saw




PostPosted: Thu Jun 15, 2006 4:25 pm   Post subject: (No subject)

hehe ive read your walkthrough before learned all that stuff but thats not what we are doing here, instead of getting rid of a cursor i want to add one where there regularly wouldnt be one, but like bored said :
Quote:
that would be something you yourself would have to draw
i think that maybe the only way to get one too, was just checking to see if anybody knew any lil secret way, lol
Bored




PostPosted: Thu Jun 15, 2006 5:27 pm   Post subject: (No subject)

Haaaaaa, I'm a genious. I found one of the few good uses for processes. I'm assuming, you are going to use Input.Pause at the end to wait for the user to continue, well Input.Pause leaves a cursor, and well just look
code:
var done := false
var continue := false
var sentance : string := "This text should appear one letter at a time."

process cursor
    loop
        Input.Pause
        exit when done
    end loop
    continue := true
end cursor

fork cursor
for i : 1 .. length (sentance)
    put sentance (i) ..
    delay (100)
end for
done := true
loop
    exit when continue
end loop

What I'm doing here is making a process that will have Input.Pasue to add the cursor, but will only exit once the text is done. Then aswell as a cursor you have your Inpu.Pause at the end as the program will not continue until the process ends (the user presses any key).
upthescale




PostPosted: Thu Jun 15, 2006 7:15 pm   Post subject: (No subject)

and you can do it with font, but im having trouble there has tro be an easier way.. lol

code:

var sentance : string := "This text should appear one word at a time."
var font : int := Font.New ("arial:20")
var x : int := 100
for i : 1 .. length (sentance)
    %  put sentance (i) ..
    Font.Draw ("" + sentance (i), x, 200, font, 12)

    delay (60)
    x += 15
end for

Sponsor
Sponsor
Sponsor
sponsor
Hack.saw




PostPosted: Thu Jun 15, 2006 7:17 pm   Post subject: (No subject)

OMG! was that like some divine message you just got??? It works perfectly! Hahahahaha... I knew there had to be some lil trick you could do (there always is in programming Very Happy ) TY sooo much, lol. Would give you bits for figuring that out but dont havetoo many to give away Sad
upthescale




PostPosted: Thu Jun 15, 2006 7:19 pm   Post subject: (No subject)

wont let me edit, but i made a cool effect, without that x variable

code:

var sentance : string := "This text should appear one word at a time."
var font : int := Font.New ("arial:20")

for i : 1 .. length (sentance)
    %  put sentance (i) ..
    Font.Draw ("" + sentance (i), i * 18, i*18, font, 12)

    delay (120)

end for

Hack.saw




PostPosted: Thu Jun 15, 2006 7:20 pm   Post subject: (No subject)

Hehe thanks for trying "upthescale"but im just gona use the reg text since it fits mission briefing text perfectly Smile
Hack.saw




PostPosted: Thu Jun 15, 2006 7:23 pm   Post subject: (No subject)

... you keep posting the exact same time i do... lol. Its not letting me edit either, no clue why. I like how you got it to go up at the angle like that (I could use that for a intro scene) thanks for helping me again Very Happy )
upthescale




PostPosted: Thu Jun 15, 2006 8:01 pm   Post subject: (No subject)

ok here is some text, when it breaks that is wehen i wanan start a new line how?

code:

setscreen ("offscreenonly;graphics:600;500;position:100;100;nobuttonbar")
var Message : string := "Hello agent, I bet you are just so eager to start your mission!"
var font : int := Font.New ("arial:14")

colorback (7)
cls




for Effect : 1 .. length (Message)
    locate (12, Effect)
    color (0)
    put Message (Effect) ..

    if Effect > 40 then
        break
    end if
    delay (60)
    View.Update
end for

TheOneTrueGod




PostPosted: Thu Jun 15, 2006 8:43 pm   Post subject: (No subject)

code:

put ""..
upthescale




PostPosted: Thu Jun 15, 2006 8:46 pm   Post subject: (No subject)

Did not werk OneTrueGod, because the words continueson the same line, i would like so when they get to the end of the turing screen (maxx) then ther words will go on to the next line..thx
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 1 of 2  [ 19 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: