Alright, school is back in session. Time to hand in your first homework assignment. And don't you tell me the bot ate it.
Your project was to create a sort of time-delay message of the day, with one part printing after the other was done. This can be accomplished in just one file in just one subroutine. That is client.qc and PlayerPostThink() respectively.
At the end of that routine, you could have posted something like this:
if (time < 3) centerprint(self, "Now playing the WonkaBot\n"); if (time >= 3 && time < 6) centerprint(self, "Written by Mr. Wonka\n");That's it. Remember, PlayerPostThink() is called after every frame of animation; basically, it is called almost continuously. Remember something else: you cannot print() anything when the world first spawns. It's just a little weird thing about QuakeC.
create_message_machine();Then, before that subroutine, you could paste this:
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void() create_message_machine = // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ { local entity mach; if (time > 3) return; mach = spawn(); mach.owner = self; mach.think = message_think; mach.nextthink = time + 0.1; };Right. Recall that we said that we cannot print a message immediately after the world spawns. So here we create an independent "machine" to print a message in 0.1 seconds.
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void() message_think = // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ { self.nextthink = time + 0.1; if (time < 3) centerprint(self.owner, "Now playing the WonkaBot\n"); if (time >= 3 && time < 6) centerprint(self.owner, "Written by Mr. Wonka\n"); if (time > 6) remove(self); };The self here is the machine entity; the self.owner is the player. This routine prints the same message as before to that player's screen. It thinks every 0.1 seconds. After six seconds, it removes itself, never to be seen nor heard again.