Author Topic: Is there anything faster then AppOnIddle?  (Read 1525 times)

0 Members and 1 Guest are viewing this topic.

Offline As de Espada

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1493
  • Mapper
    • My maps
Is there anything faster then AppOnIddle?
« on: July 05, 2008, 09:32:15 am »
(60 ticks = 1000 ms)
But I couldn't find any way to make a precedure be called more then each second.
I thought about something with a bot being hit... but that's kinda hardwork

is there anyway to use ms or ticks to call a procedure?
like, I want a procedure to be called each 10 ticks (6 times a sec). How should I do it?
All my maps | my latest map: SoldatX Racing Mappack
me making a map on youtube: ctf_FastMade

Offline sai`ke

  • Camper
  • ***
  • Posts: 318
  • Can't be arsed to remove christmas avatar
Re: Is there anything faster then AppOnIddle?
« Reply #1 on: July 05, 2008, 09:54:23 am »
No.

You can use threadFunc to make a separate thread for a process, and use sleep to time things in there, but this will make your server horribly unstable and I really wouldn't recommend it.

Bot being hit? How about using onPlayerDamage?
#soldat.ttw #ttw.gather --- Quakenet!
http://ttwforums.com

Offline As de Espada

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1493
  • Mapper
    • My maps
Re: Is there anything faster then AppOnIddle?
« Reply #2 on: July 05, 2008, 10:03:14 am »
yeah... I thought of that. It would be a bot freezed in a position, and a bullet being created right in the top of it. Then in the procedure onplayerdamage it verifyes if the bot it's being hit, then it calls a procedure and creates another bullet. That way the bot would be hit more than once per second, depending on the verlocity of the bullet.

what's that threadFunc you were talking?
All my maps | my latest map: SoldatX Racing Mappack
me making a map on youtube: ctf_FastMade

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Is there anything faster then AppOnIddle?
« Reply #3 on: July 05, 2008, 10:29:20 am »
Different methods of calling ApponIdle (or a similar function) more often:
-The bot being hit by bullets you mentioned
-Having a bot connect to the server, sending data every so often telling the script to do something
-Threads (unstable)

Offline As de Espada

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1493
  • Mapper
    • My maps
Re: Is there anything faster then AppOnIddle?
« Reply #4 on: July 05, 2008, 10:31:30 am »
can you talk more about threads? how do I call them?

Date Posted: July 05, 2008, 01:30:24 pm
my idea is to use the ticks, because they exist, or ms, but ticks would be better
All my maps | my latest map: SoldatX Racing Mappack
me making a map on youtube: ctf_FastMade

Offline sai`ke

  • Camper
  • ***
  • Posts: 318
  • Can't be arsed to remove christmas avatar
Re: Is there anything faster then AppOnIddle?
« Reply #5 on: July 05, 2008, 10:38:54 am »
Let's say you have a routine called poop, which displays the name of the killed player and you want this to display 200 milliseconds after the player died. Which is defined like this:

Code: [Select]
procedure poop(ID: byte);
begin
sleep(200);
WriteConsole( 0, GetPlayerStat( ID, 'Name' ) + ' was killed about 200 ms ago!', $FFFFFFFF );
end;

What you can do then is put a threadFunc in onPlayerKill.

threadFunc( [Victim], 'poop' );

This will start the routine, while the rest of the server just continues running. Using threadFunc will make your server crash very often though!!

What is it you are trying to do? Maybe we can find a way to get the desired result without using crappy solutions like this.
#soldat.ttw #ttw.gather --- Quakenet!
http://ttwforums.com

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Is there anything faster then AppOnIddle?
« Reply #6 on: July 05, 2008, 10:54:27 am »
Now for something more like AppOnIdle, try...

Code: [Select]
function AppOnIdleB(const Ticks: cardinal);
begin
end;

procedure AppOnIdleLoop(const Delay: integer);
begin
  while true do begin
    Sleep(Delay);
    AppOnIdleB(GetTickCount());
  end;
end;

procedure ActivateServer();
begin
  ThreadFunc([200], 'AppOnIdleLoop');
end;

but the tick count may change as AppOnIdleB goes through..

(untested)

Offline As de Espada

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1493
  • Mapper
    • My maps
Re: Is there anything faster then AppOnIddle?
« Reply #7 on: July 05, 2008, 06:02:49 pm »
you mean there's something called GetTickCount()? wow
ok with the thread, thanks, will test that
All my maps | my latest map: SoldatX Racing Mappack
me making a map on youtube: ctf_FastMade

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Is there anything faster then AppOnIddle?
« Reply #8 on: July 06, 2008, 04:41:27 am »
This won't work on most operating systems since a) ThreadFuncs tend to fuck the server up and b) so does the sleep function. In combination, they are of course even worse :Q

Since I had been in need for something like this aswell several times, I have recently started coding a little work around for this. It's rather complicated though and uses a bot over which a bullet is spawned and then calls the "new" AppOnIdle event in OnPlayerDamage and spawns another bullet over the bot.
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline BombSki

  • Flagrunner
  • ****
  • Posts: 927
    • Climbing-soldiers.net
Re: Is there anything faster then AppOnIddle?
« Reply #9 on: July 06, 2008, 07:56:41 am »
the basketball script uses the system avarax is talking about to make a 5x/second apponidle

http://forums.soldat.pl/index.php?topic=26433.0