I'm working on a new intro routine for Annals of Ea, and want to try to get some text on the screen to shimmer, until the player presses a key. I have no trouble with the shimmering, it's just that I don't seem to be able to get a loop to run continuously, and do what's in it until the player presses something.
Here's an example of what I've been trying so far:
while (inkey() == FALSE) do
Term_putch(x,y,colour,str)
end
,but it does not seem to act out the bit in the while clause.
Any help appreciated -- TheFalcon.
NeilStevens: To see some keyboard input routines, read the Minas Anor library quest script. In there I use the keyboard to manage the book creation process.
TheFalcon: Thanks. I sorted the problem by doing something like this:
local i = 0
while i < 1 do
script_foo...
inkey_scan = TRUE
key = inkey()
if key ~= 0 then
break
end
end
end
NeilStevens: To create an infinite loop just do while true instead of using that extra variable i.
TheFalcon: Cool, thanks.
[later...] I don't suppose I can get it to do two things at once?
I.e. can I get the game to run an infinite loop, to provide me with a shimmering effect, and get it to load some more text at the same time.
Failing that, is there a way to get the game to give me a "real-time" counter, so that it will give a count in milliseconds or some such, and I can call this to find timings for shimmering and loading stuff?
(Hmm, this is getting worryingly advanced for a simple intro :D)
NeilStevens: No. You are not going to do be able to do that. If you want realtime graphics effects, you are not going to want to use T-engine. So stop wasting your time trying to hack such effects into the system when they're not going to happen, is my advice.
TheFalcon: Point taken.
ToME Wiki