Have a question about modding, modelling or skinning? Have a tutorial to post? Post here!
Moderator: Core Staff
-
F |Madness| U
- CJ G0D!
- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Post
by F |Madness| U » June 15th, 2011, 7:56 pm
I managed to make a timer using loops of i decreasing each time. However, if I use printlnbold, the timer becomes very messy. By this I mean if it starts at 59, it will go down to 58, then flash back to 59, then go down to 57, then flash back to 58, then go down to 56, then flash back to 57 etc. I think this is because the printlnbold messages stay on the screen for a few seconds, they don't get deleted so it is kind of overlapping times. How could I get around this? My code is:
Code: Select all
clock()
{
level timer1();
level timer2();
level timer3();
level timer4();
}
timer1()
{
for(i=59;i>9;i--)
{
iprintlnbold("1:" + i);
wait 1;
}
}
timer2()
{
for(i=9;i>-1;i--)
{
iprintlnbold("1:0" + i);
wait 1;
}
}
timer3()
{
for(i=59;i>9;i--)
{
iprintlnbold("0:" + i);
wait 1;
}
}
timer4()
{
for(i=9;i>-1;i--)
{
iprintlnbold("0:0" + i);
wait 1;
}
}
-
-
IzNoGoD
- CJ Worshipper
- Posts: 343
- Joined: January 6th, 2009, 8:39 pm
- Location: Netherlands/Holland
Post
by IzNoGoD » June 15th, 2011, 8:06 pm
Create a hud element.
Read through the docs or stock scripts on how to do so.
Use settimer(60) or smthing on it.
LMGTFY!
Its not a glitch... Its the future!
-
F |Madness| U
- CJ G0D!
- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Post
by F |Madness| U » June 15th, 2011, 8:23 pm
Okay thanks I'll look into it. I also have another large proble, but I'll create a new thread for that.
-
-
Rezil
- Core Staff
- Posts: 2030
- Joined: July 24th, 2006, 11:21 am
- Location: Cramped in a small cubicle/making another jump map
Post
by Rezil » June 15th, 2011, 8:45 pm
Code: Select all
player.timer = newclienthudelem(player);
player.timer.x = 50;
player.timer.y = 50;
player.timer.allignx = "left";
player.timer.alligny = "top";
player.timer.color = (1, 1, 1);
player.timer settimer(60);
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.
-
F |Madness| U
- CJ G0D!
- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Post
by F |Madness| U » June 15th, 2011, 9:42 pm
Ah thankyou Rezil, I didn't know there were built in timers D:
-
-
F |Madness| U
- CJ G0D!
- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Post
by F |Madness| U » June 17th, 2011, 12:26 pm
I've ran into a problem with this, I want the timer to start as soon as the map has loaded (before anyone has even connected). And if I use this timer, player is not defined. And if I start the timer when a player connects, then each player will have a seperate timer, whereas I want just one timer where all players see the same time, similar to the match timers in bottom left hand corner. And I'm a nooby at this and can't think what I have to do to make this
-
-
IzNoGoD
- CJ Worshipper
- Posts: 343
- Joined: January 6th, 2009, 8:39 pm
- Location: Netherlands/Holland
Post
by IzNoGoD » June 17th, 2011, 12:52 pm
Rezil wrote:Code: Select all
player.timer = newhudelem();
timer.x = 50;
timer.y = 50;
timer.alignx = "left";
timer.aligny = "top";
timer.color = (1, 1, 1);
timer settimer(60);
Use this...
LMGTFY!
Its not a glitch... Its the future!
-
Drofder2004
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » June 17th, 2011, 8:38 pm
IzNoGoD wrote:Rezil wrote:Code: Select all
player.timer = newhudelem();
timer.x = 50;
timer.y = 50;
timer.alignx = "left";
timer.aligny = "top";
timer.color = (1, 1, 1);
timer settimer(60);
Use this...
Change player.timer, to simply "timer".
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
-
IzNoGoD
- CJ Worshipper
- Posts: 343
- Joined: January 6th, 2009, 8:39 pm
- Location: Netherlands/Holland
Post
by IzNoGoD » June 17th, 2011, 11:32 pm
Drofder2004 wrote:IzNoGoD wrote:Rezil wrote:Code: Select all
player.timer = newhudelem();
timer.x = 50;
timer.y = 50;
timer.alignx = "left";
timer.aligny = "top";
timer.color = (1, 1, 1);
timer settimer(60);
Use this...
Change player.timer, to simply "timer".
Overlooked that one..
Thanks for the correction though
LMGTFY!
Its not a glitch... Its the future!
-
F |Madness| U
- CJ G0D!
- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Post
by F |Madness| U » June 18th, 2011, 12:37 am
Thanks all of you, I was being a retard for part of my scripting which was also why it wasn't working
-
-
F |Madness| U
- CJ G0D!
- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Post
by F |Madness| U » June 18th, 2011, 10:22 pm
Okay, really stupid question, but how do I make the timer disappear? I tryed timer destroyelem(); , but for some reason that caused the game to freeze once it got to that line of code. Any suggestions? I'll post code in a sec.
-
-
Drofder2004
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » June 18th, 2011, 10:25 pm
F |Madness| U wrote:Okay, really stupid question, but how do I make the timer disappear? I tryed timer destroyelem(); , but for some reason that caused the game to freeze once it got to that line of code. Any suggestions? I'll post code in a sec.
"Destroy()" should do the job.
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
-
F |Madness| U
- CJ G0D!
- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Post
by F |Madness| U » June 18th, 2011, 10:34 pm
Ahhh now it works, thanks once again!
-
Users browsing this forum: No registered users and 37 guests