Author |
Message |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
|
Back to top |
|
 |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Fri Jul 13, 2007 9:53 pm Post subject: |
 |
|
|
|
I've found a way, i just don't know what the call back is for when someone is IN the zone. not entering. this is not what i want at all. |
|
Back to top |
|
 |
k0zy Server Help Squatter

Gender: Joined: Jan 11 2003 Posts: 571 Location: Germany Offline
|
Posted: Sat Jul 14, 2007 4:27 am Post subject: |
 |
|
|
|
tcsoccerman wrote: | I've found a way, i just don't know what the call back is for when someone is IN the zone. not entering. this is not what i want at all. |
I never coded for ASSS, but:
If someone enters the zone, he/she is in there until leaving it!? _________________ It's a shark! Oh my god! Unbelievable! |
|
Back to top |
|
 |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Sat Jul 14, 2007 11:01 am Post subject: |
 |
|
|
|
Lol, sorry. i meant region, not zone. |
|
Back to top |
|
 |
Animate Dreams Gotta buy them all! (Consumer whore)

Age:37 Gender: Joined: May 01 2004 Posts: 821 Location: Middle Tennessee Offline
|
Posted: Sat Jul 14, 2007 2:58 pm Post subject: |
 |
|
|
|
I'm pretty sure for that, you'll have to use ASSS Regions. Make the "hill" a region, and use the region callback to see when people enter. Just interrupt the timer if if the player ever leaves the region. You could record their position every second or something, and check to see if it was within a certain boundary, but... I'm sure regions are much easier. Only problem I would see is if regions happen to take a while to respond(if I remember right it does take a second or so). |
|
Back to top |
|
 |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Sat Jul 14, 2007 3:53 pm Post subject: |
 |
|
|
|
How many pixels are in a tile?16?24? |
|
Back to top |
|
 |
Animate Dreams Gotta buy them all! (Consumer whore)

Age:37 Gender: Joined: May 01 2004 Posts: 821 Location: Middle Tennessee Offline
|
Posted: Sat Jul 14, 2007 3:56 pm Post subject: |
 |
|
|
|
Hm... I always thought it was seven. But I'm probably thinking this because a standard ship's radius is 14, which is big enough to be blocked by a single tile gap, but it fits in a 2 tile gap.
Edit: I found this in the wiki: http://wiki.minegoboom.com/index.php/Tiles which says tiles are 16x16. I confused radius and diameter, which is why my last statement doesn't make sens. >_< |
|
Back to top |
|
 |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Sat Jul 14, 2007 5:33 pm Post subject: |
 |
|
|
|
I figured that out w/ dcme. Now all i need is coding that pauses the current process for x seconds(preferabbly small and precise), and then resumes the process after x secnods have passed. know how? C language. |
|
Back to top |
|
 |
k0zy Server Help Squatter

Gender: Joined: Jan 11 2003 Posts: 571 Location: Germany Offline
|
Posted: Sat Jul 14, 2007 5:55 pm Post subject: |
 |
|
|
|
sleep
and
usleep |
|
Back to top |
|
 |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Sat Jul 14, 2007 6:05 pm Post subject: |
 |
|
|
|
Example? |
|
Back to top |
|
 |
Smong Server Help Squatter

Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Sat Jul 14, 2007 6:28 pm Post subject: |
 |
|
|
|
You don't want to use sleep in a module, you could end up freezing the entire server.
Also I doubt you want to use regions if this is for a hill that can move around. If all you can get is enter/exit events just follow k's advice and stop/pause the timer as soon as you get an exit event.
What I did in the original halo_hill module was set an asss timer to trigger on every second. Then inside this timer I checked all the player positions to see if they were inside the hill or not. If one team had more players inside than the other than I decremented that team's timer by 1.
Now about your goal, did you want like a meter than increases the longer you stay in the area? And then this meter resets as soon as you leave it?
Or did you want to display how many players each team currently has inside the hill? _________________ ss news  |
|
Back to top |
|
 |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Sat Jul 14, 2007 6:43 pm Post subject: |
 |
|
|
|
Ok, i see. i do want to use regions because the hills don't move. What area of code did you trigger the timer every second?I want the idea of a meter that increases every second in the hill, but doesn't reset when you leave it.once they are in the hill for long enough, that players team owns the hill. |
|
Back to top |
|
 |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Sat Jul 14, 2007 6:51 pm Post subject: |
 |
|
|
|
I see it now in mainloop.h . What do the keys and stuff represent? What should i set them to if i want something similiar to you're hill module to occur, every second.
It would be most useful if it waits for 1 second, then continues. The purpose of this coding is to put a second b/w the meter gfx so the meter doesn't fill up in a instant, but instead takes a while. |
|
Back to top |
|
 |
Animate Dreams Gotta buy them all! (Consumer whore)

Age:37 Gender: Joined: May 01 2004 Posts: 821 Location: Middle Tennessee Offline
|
Posted: Sat Jul 14, 2007 11:55 pm Post subject: |
 |
|
|
|
Unfortunately there isn't really a way to just pause your module, you have to use timers. :| It WOULD be nice to have a way to delay a module for a few seconds, and it might even be possible to write a Pause() function that took a number of seconds in as a parameter. I might try that some time, but I keep forgetting how timers work. |
|
Back to top |
|
 |
k0zy Server Help Squatter

Gender: Joined: Jan 11 2003 Posts: 571 Location: Germany Offline
|
Posted: Sun Jul 15, 2007 6:50 am Post subject: |
 |
|
|
|
The problem with that is that while the module is in the Pause() function the module is unable to handle any other events that might occur.
And if you use a timer with a callback you're not able to jump back to where you called Pause().
You could start a different thread that does whatever you want and where it is safe to sleep in, though.
The manpage of sleep and usleep say that sleep suspends a process, however I remember using sleep in a threaded program without a problem. |
|
Back to top |
|
 |
Smong Server Help Squatter

Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Sun Jul 15, 2007 6:57 am Post subject: |
 |
|
|
|
The key in SetTimer is so you can cancel a specific timer. You might want to do this when the module detaches, to clean up neatly. In this case setting the key to be the arena is a good idea. You don't have to use a key if you don't need to, but if your module detaches/unloads and any running timers are not stopped could crash the server.
To make the timer get called ever second set the interval to 100 ticks. The initial delay can be anything small, maybe 500 if you are calling it in MM_ATTACH or set it to 0 if the game starts on command.
You'll want to set the "param" parameter to the arena, so you can access the arena data inside the timer.
Also don't forget to make the timer return 1 so it repeats.
local int timer(void *arena_)
{
Arena *arena = arena_;
struct adata *ad = P_ARENA_DATA(arena, adkey);
//count players here, etc
return 1;
}
EXPORT int MM_halo_hill(int action, Imodman *mm_, Arena *arena)
{
...
else if (action == MM_ATTACH)
{
ml->SetTimer(timer, 500, 100, arena, arena);
}
else if (action == MM_DETACH)
{
ml->ClearTimer(timer, arena);
} |
|
|
Back to top |
|
 |
Dr Brain Flip-flopping like a wind surfer

Age:39 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Sun Jul 15, 2007 10:39 am Post subject: |
 |
|
|
|
Smong wrote: | The key in SetTimer is so you can cancel a specific timer. You might want to do this when the module detaches, to clean up neatly. In this case setting the key to be the arena is a good idea. You don't have to use a key if you don't need to, but if your module detaches/unloads and any running timers are not stopped could crash the server. |
You can use use ml->ClearTimer(timer, NULL) to clear without keys. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me |
|
Back to top |
|
 |
|