Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
controllable doors

 
Post new topic   Reply to topic Printable version
 View previous topic  chatmenu Post :: Post Problem with "Adding Commands&quo...  View next topic  
Author Message
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Sun Aug 07, 2005 7:37 am    Post subject: controllable doors Reply to topic Reply with quote

Here's a module that use regions to open doors for 5 seconds.

The module is usable as is, but is quite basic. Adding more functionality such as closing doors when entering a region, or restricting to certain ships/freqs shouldn't be too hard to add.

It does write to arena.conf every time a door is toggled, I did try the temporary setting thing but it didn't seem to work.




v1 src doc dll arena

asss-door.zip - 33.15 KB
File downloaded or viewed 75 time(s)
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Bak
?ls -s
0 in


Age:24
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Sun Aug 07, 2005 8:53 am    Post subject: Reply to topic Reply with quote

I didn't know you could pass arena parameters to the timer, good work.
_________________
SubSpace Discretion: A Third Generation SubSpace Client
Back to top
View users profile Send private message Add User to Ignore List AIM Address
50% Packetloss
Server Help Squatter


Age:39
Gender:Gender:Male
Joined: Sep 09 2003
Posts: 561
Location: Santa Clarita, California
Offline

PostPosted: Sun Aug 07, 2005 4:17 pm    Post subject: Reply to topic Reply with quote

mainloop.h
Code: Show/Hide

   /** Starts a timed event.
    * @param func the TimerFunc to call
    * @param initialdelay how long to wait from now until the first
    * call (in ticks)
    * @param interval how long to wait between calls (in ticks)
    * @param param a closure argument that will get passed to the timer
    * function
    * @param key a key that can be used to selectively cancel timers
    */
   void (*SetTimer)(TimerFunc func, int initialdelay, int interval,
         void *param, void *key);

/** timer functions must be of this type.
* @param param is a closure argument
* @return true if the timer wants to continue running, false if it
* wants to be cancelled
*/
typedef int (*TimerFunc)(void *param);


Why did you use cfg->FlushDirtyValues();? Was the server not updating it fast enough? I think it does it every 500 ticks?
_________________
Current Terror Alert Level
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Sun Aug 07, 2005 6:15 pm    Post subject: Reply to topic Reply with quote

The door only opens for 5 seconds anyway, plus it would look better if it opened as soon as the player triggered it.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Grelminar
Creator of Asss


Joined: Feb 26 2003
Posts: 378
Offline

PostPosted: Wed Aug 10, 2005 7:55 pm    Post subject: Reply to topic Reply with quote

I didn't actually look at the source, but your comments indicate that you're using cfg->SetInt. Much better would be to use clientset->ArenaOverride, and then clientset->SendClientSettings on each player (and if it's a common pattern, I can add a utility function to do that second part). That will avoid going through the config system entirely, so you won't have to worry about conf files, and you have control over when the packets are sent.

I am curious why the temporary thing wasn't working, though.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Thu Aug 11, 2005 1:17 pm    Post subject: Reply to topic Reply with quote

It seemed the temporary settings only got sent to clients when a permanent setting was written to disk during the dirty status check.

I don't think the temporary settings were marked as dirty, but when settings are written to disk it thens calls a settings change callback which I suspect causes another module to send the necessary packets.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Grelminar
Creator of Asss


Joined: Feb 26 2003
Posts: 378
Offline

PostPosted: Thu Aug 11, 2005 4:41 pm    Post subject: Reply to topic Reply with quote

Oh, I see. There are various ways to fix that, although none of them is really satisfactory. It would be bad, for example, to do the config changed callback after every temporary settings change, because that would lead to bad behavior if you're doing 100 of them in a row. It might be possible to have temporary changes get marked as dirty, so the periodic file updater would see them and do the callback, but not write them to disk. Another solution might be to add a function to clientset to reload all settings and send the packets if necessary, just like the config changed callback does.

But I'm more inclined to do nothing, and instead have people use the clientset override functions, which are the better solution.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
Elnino
Newbie


Joined: Aug 10 2006
Posts: 14
Offline

PostPosted: Thu Aug 17, 2006 3:21 pm    Post subject: Reply to topic Reply with quote

What if I crontab a cp command to overwrite the arena.conf ?
like "cp arena.ok arena.conf"
that's a little dirty but anyone else found something ... ?

sry for waking this old thread up biggrin.gif

Thx
Elnino
Back to top
View users profile Send private message Add User to Ignore List
D1st0rt
Miss Directed Wannabe


Age:36
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Sun Aug 27, 2006 1:32 pm    Post subject: Reply to topic Reply with quote

The best way to do it is clientset overrides, don't use crontab. The Hyperspace racing module uses overrides and they're just dandy.
_________________

Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Elnino
Newbie


Joined: Aug 10 2006
Posts: 14
Offline

PostPosted: Tue Aug 29, 2006 10:38 am    Post subject: Reply to topic Reply with quote

Thx D1st0rt

You have some code snipplet or some doc to help a newbie ?

or you can just post the line Ill figure the stuff all by myself biggrin.gif
Back to top
View users profile Send private message Add User to Ignore List
D1st0rt
Miss Directed Wannabe


Age:36
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Tue Aug 29, 2006 9:39 pm    Post subject: Reply to topic Reply with quote

Here's how it's set up in the race module:

at the top you have to include a header
Code: Show/Hide
#include "clientset.h"

Then you need to declare a variable for the clientset module and your setting
Code: Show/Hide
local Iclientset *cs;
local override_key_t ok_DoorMode;

In MM_LOAD, you need to initialize your override key
Code: Show/Hide
ok_DoorMode = cs->GetOverrideKey("door", "doormode");

In the arena settings I had the door mode defaulted to have them open so I overrided it to close and then removed the override it to open them again.
Code: Show/Hide
local void closeDoors(Arena *a)
{
   Player *p;
   Link *link;

   cs->ArenaOverride(a, ok_DoorMode, 255);

   pd->Lock();
   FOR_EACH_PLAYER(p)
   {
      if(p->arena == a)
         cs->SendClientSettings(p);
   }
   pd->Unlock();
}

local void openDoors(Arena *a)
{
   Player *p;
   Link *link;

   cs->ArenaUnoverride(a, ok_DoorMode);

   pd->Lock();
   FOR_EACH_PLAYER(p)
   {
      if(p->arena == a)
         cs->SendClientSettings(p);
   }
   pd->Unlock();
}

Alternatively you could do something like have a function that takes door mode as a parameter.

In MM_DETACH I call the openDoors function to remove the override, I don't know if this is necessary but it's probably still a good idea.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Elnino
Newbie


Joined: Aug 10 2006
Posts: 14
Offline

PostPosted: Wed Aug 30, 2006 10:46 am    Post subject: Reply to topic Reply with quote

Godly !
Back to top
View users profile Send private message Add User to Ignore List
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Custom Projects All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 413 page(s) served in previous 5 minutes.

phpBB Created this page in 0.516537 seconds : 38 queries executed (89.8%): GZIP compression disabled