Text Effects

francisstokes
23 Jul 2005, 20:44
This might get some of you thinking if you want some sort of text effect.This prints text by the letter, but i took the longest way around the whole thing so if you use it, you'll probably have to redo the whole thing:-


define game <Cool Text>
asl-version <350>
gametype singleplayer
start <start>
game author <Francis Stokes>
game info <Trying to get some text effect here.>
end define

define synonyms
end define

define room <start>
script msg <|c>
end define

define procedure <text>
flag on <1>
if flag <1> and not flag <2> and not flag <3> and not flag <4> then {
msg <|c>
set string <quest.lookdesc; c>
timeroff <text>
timeron <text>
flag on <2>
}
else {
if flag <1> and flag <2> and not flag <3> and not flag <4> then {
msg <|c>
set string <quest.lookdesc; co>
timeroff <text>
timeron <text>
flag on <3>
}
else {
if flag <1> and flag <2> and flag <3> and not flag <4> then {
msg <|c>
set string <quest.lookdesc; coo>
timeroff <text>
timeron <text>
flag on <4>
}
else {
msg <|c>
set string <quest.lookdesc; cool>
timeroff <text>
}
}
}

end define

define procedure <1>
msg <|c>
msg <|jc#quest.lookdesc#>
end define

define timer <text>
interval <1>
action do <text>
enabled
end define

define timer <printing>
interval <1>
action do <1>
enabled
end define

paul_one
24 Jul 2005, 10:36
There's no need to clear the screen everytime.

Just add the "|xn" to the end of the text, and it means no new line is created!

So:
msg <c|xn>
msg <o|xn>
msg <o|xn>
<msg <l|xn>
Will print out:
cool

... You should also make that whole thing into a procedure, pass it a string and go through the letter, one by one, having a "pause <500>" (500 milliseconds = 2 letters per second... sounds about right IMO - maybe less, like 300 or something) inbetween each letter is displayed.

In the help documentation look under "built-in functions" as there's alot to do with text manipulation that you can use to get a single letter and then the next letter etc.
But nice idea, and nice try at implementing it.

paul_one
25 Jul 2005, 12:37
define game <Intro>
asl-version <350>
gametype singleplayer
start <room1>
game author <Tr0n²>
game version <1.00>
game info <Created with Notepad++|n _
© Tr0n (MiNE Inc), 2005|n>

startscript {
set string <text; This is the text which will be output.|nIt sould go through bit by bit but I'm not sure about new lines. _
|crColour's might be able to go through too!|n_
What about bits at the END of a string eh?:|b>
do <intro(#text#)>
msg <|cb |xb>
}

end define

define room <room1>

end define

define procedure <intro>
set string <typeW.text; $parameter(1)$>
set numeric <typeW.text.len; $lengthof(#typeW.text#)$>
for <typeW.loop.A; 1; %typeW.text.len%> {
set string <test; $mid(#typeW.text#; %typeW.loop.A%; 1)$>
if ( $mid(#typeW.text#; %typeW.loop.A%; 1)$ = | ) then {
msg <$mid(#typeW.text#; %typeW.loop.A%; 3)$|xn>
inc <typeW.loop.A; 2>
}
else msg <$mid(#typeW.text#; %typeW.loop.A%; 1)$|xn>
pause <100>
}
end define

As you see, this does the sort of thing, and instead of doing each bit individually you just pass a WHOLE lump of text to the procedure. Then it goes through each letter one by one (or in a lump of 3 if you're doing a |n (newline) |cr (colour) |b |xb (bold on/off).). The only thing it can't handle is sizes...
I didn't want to have such a big gap (doing this would mean a string of:
"hello|nworld" would go through like so:
"h...e...l...l...o...
wo...r...l...d..."
There is a work around - you put a break in:
do <intro(hello|nw)>
msg <|s50|xn>
do <intro(orld)>


Erm, a more thurough explaination of the code will code after work.