Server Help

ASSS Custom Projects - Spree module

Smong - Mon Feb 16, 2004 8:34 am
Post subject: Spree module
Spree. Send arena messages at any number of kills with any bong. Some advanced settings too.
Code: Show/Hide
[Spree]
ResetSpreeOnFrequencyChange=0
  ;Changing freq resets the spree (default=0)
ResetSpreeOnShipChange=0
  ;Changing ship resets the spree (default=0)
SpreeEndMinimum=4
  ;If a player on a spree has this many kills and dies..
  ;(default=65535)
SpreeEndMessage=has had their spree cut short
  ;..this message will be displayed..
SpreeEndBong=22
  ;..and this bong played. (default=0)
  ;<name> <SpreeEndMessage> <%SpreeEndBong>
 
Message3=is dominating (3:0)
  ;On 3 consecutive kills, this message will be displayed
Bong3=13
  ;This bong will be played with the message (default=0)
  ;<name> <Message#> <%Bong#>

Versions:
asss-spree.zip v1 (asss-1.1.7)
asss-spree-1.4.zip v1.4
asss-spree-1.5.zip v1.5 (asss-1.3.2)
asss-spree-1.7.zip v1.7 (asss-1.3.6)

Siaons versions:
Spree.rar r1
Hyperspace Spree.rar r2
Hyperspace Spree.zip r3
Mine GO BOOM - Mon Feb 16, 2004 10:44 am
Post subject:
Should maybe think about adding some commands, optional via the .conf files, to see current people with killing sprees, current people with killing sprees >= X, and maybe people's best killing sprees, if you want to deal with stat-saving.
CypherJF - Mon Feb 16, 2004 1:02 pm
Post subject:
maybe remember whose had the most kills in a row -- and a reset timer for that info ? .. just a thought
Smong - Tue Feb 17, 2004 10:31 am
Post subject:
Does this look good?
Code: Show/Hide
local helptext_t spree_help =
   "Module: spree\n"
   "Targets: arena, player\n"
   "Args: [<#>]\n"
   "Prints out the target player's current spree and best spree,\n"
   "if no target, yourself, or all players in the current arena\n"
   "with the specified spree or higher\n";

I don't think I will save stats to disk, as any arena can load the module, so there will be a lot of data being stored (I guess that is where the .conf option comes in though...).
Anonymous - Tue Mar 23, 2004 12:33 pm
Post subject:
OK, I have added ?spree. It shows current, last and best sprees. Either for you, someone else, or the whole arena when specifying a minimum spree count.

I have also added the following %macros: killer, killed, bounty, coord.

Also added the setting ResetSpreeOnFlagWin (default=0).
Anonymous - Thu Apr 08, 2004 5:34 am
Post subject:
rampage.dl for MERV, it does nearly the same, doesn't it?
Smong - Thu Apr 08, 2004 7:39 am
Post subject:
This spree module is for asss, rampage.dll is a mervbot plugin and if it uses *arena will not function correctly on asss.

I believe mine is better because my macros don't have to end in %, it shows your last spree, it shows your current streak (not # kills needed for next title/message) and you can see who else in the arena has a high spree.

I am thinking of making it display the spree messages at a random amount of kills, because it gets boring if at say 5 kills you get the message everytime.
Siaon - Sat Apr 24, 2004 7:08 pm
Post subject:
Ugh, had no idea there was something like this already, basically did everything all over, except with the ini values. If there's still an interest I guess I could post mine too.
ExplodyThingy - Sat Apr 24, 2004 8:52 pm
Post subject:
Post it. The beauty of open source development is that people use whatever version they want.
Siaon - Sat Apr 24, 2004 9:03 pm
Post subject:
I've encapsulated the whole .ini idea, just rounding down some minor changes and I'll attach it here as well.
Siaon - Sat Apr 24, 2004 10:11 pm
Post subject:
Here it is, now also supports bongs that can be configured in the .ini

[Edit] Smong's version seems to support some things in my todo list, also has a different way of giving the messages, while I arena for each kill after the treshold, he appears to only message for message<number> with the message behind it(I like the system, but it's lacking, I think I'm going to merge the idea though) [/Edit]

Ow and smong, I think it will look and work better if you remove the separate line for the sound and simply let people add %<number> to the message, much more efficient and consistent, it's what I'll do tomorrow icon_smile.gif
Siaon - Sun Apr 25, 2004 12:14 pm
Post subject:
Adding the option

OnlyTrackHighestKillingSpree

so only the person with the highest current killing spree gets to be displayed.

[Edit]
I liked a lot of your options, Smong, but I do a lot differently: I don't have a spreeend value, instead if you had a spree message display it will also display a spreeend message for you, otherwise it wont.
[/Edit]

[Edit]
Rewrote your stringreplace function, also gave it a more compliant name
Code: Show/Hide
int strrpl(char *string, const char *source, const char *dest)
{
    char buf[256];
    int number = 0;

    while (strstr(string, source))
    {
        strncpy(buf, string, strstr(string, source) - string);
        buf[strstr(string, source) - string] = '\0';
        strcat(buf, dest);
        strcat(buf, strstr(string, source) + strlen(source));
        strcpy(string, buf);
        number++;
    }

    return number;
}

It also returns just how many instances it replaced, which is usefull for adding sound in the same message, which I now also support, further I liked your message system a lot, so I basically copy-catted that, saved me some thinking time too, because I was still thinking on how to implement macroes, it hadnt even crossed my mind to go use %killer etc., I had something like %s in mind.
Code: Show/Hide
[Spree]
ResetKillingSpreeOnFreqChange=1
ResetKillingSpreeOnShipChange=1
KillingSpreeMessage2=%killer is on a killing spree(%kills:%deaths)!%104
KillingSpreeMessage4=%killer is unstoppable(%kills:%deaths)!%2
KillingSpreeMessage6=%killer laughed at %killed's efforts!(%kills:%deaths)%13

Notice how the sound's in the message(Just like in subspace itself), I get it out of the message again by doing:
Code: Show/Hide
char sound;
int i;

for (i = 255; i >= 0; i--)
        {
            strcpy(buf, "%");
            itoa(i, buf3, 10);
            strcat(buf, buf3);
            if (strrpl(buf2, buf, ""))
                sound = i;
        }

[/Edit]
Siaon - Mon Apr 26, 2004 10:23 am
Post subject:
Module as attachment(Win32 bin only, *nix users build your own)
Anonymous - Tue Apr 27, 2004 2:31 pm
Post subject:
Nice work.

I don't see a need for %kills and %deaths if after 1 death the spree is ended (maybe you have some minimum deaths option, I don't know).

I had some trouble coding my replace string function, I hope yours is tested thoroughly.

This prototype is confusing:
int strrpl(char *string, const char *source, const char *dest) ;
Looks like you put the text from the conf in 'source', an empty char buffer in 'dest' (even though it is const) and I have no idea what for 'string'. I guess old/new would be good param names, but I'm not sure if new is a reserved keyword.

Any chance of uploading a .zip version? Oh and since you said it is a win32 binary, can you compile the latest asss release and give it to explody so he can loot it?
Siaon - Tue Apr 27, 2004 3:41 pm
Post subject:
-Smong- wrote:
Nice work.

I don't see a need for %kills and %deaths if after 1 death the spree is ended (maybe you have some minimum deaths option, I don't know).

I had some trouble coding my replace string function, I hope yours is tested thoroughly.

This prototype is confusing:
int strrpl(char *string, const char *source, const char *dest) ;
Looks like you put the text from the conf in 'source', an empty char buffer in 'dest' (even though it is const) and I have no idea what for 'string'. I guess old/new would be good param names, but I'm not sure if new is a reserved keyword.

Any chance of uploading a .zip version? Oh and since you said it is a win32 binary, can you compile the latest asss release and give it to explody so he can loot it?


Yes, I was building in support for more then a single death to end a killing spree icon_smile.gif

I agree with the parameter naming, good thinking, I basically tried to take these from the string.h, was thinking like: it works on string replacing const source with const dest, but it can probably use a better naming.

I didn't have any problems at all with writing it, I'm pretty sure it's 100% foolproof(Except that it doesn't do memory overflow checks)

And last but not least, the source is ofcourse included, so the linux people can compile their own binary(I currently don't have linux installed, I'm not a linux fan)

I'll attach a zipped version to this post btw.

I'm still adding more features, and have my todo list to work off, also wanted to say your spree module was really handy(If you compare my old module to this one, you'll see many improvements, some of which where derived in one form of the other from your brainstorm)

Anyway, if you'd like to work together, give me a message, I like the way you did certain things(Though obviously not all, I for one would never do a while(1) loop with an if clause in it icon_smile.gif, don't know if that can be considered as good/bad coding though, but still you seem really creative and that's something into which I can release some energy as well)
Siaon - Sun May 02, 2004 8:41 am
Post subject:
Edit: Some bugs in this because of my bad renaming, will fix this asap.

Code: Show/Hide
int strrpl(char *dest, const char *source, const char *target)
{
    int number = 0;
    char buf[512];

    if (strstr(target, source))
        return -1;

    while (strstr(dest, source))
    {
        strncpy(buf, dest, strstr(dest, source) - dest);
        buf[strstr(dest, source) - dest] = '\0';
        strcat(buf, dest);
        strcat(buf, strstr(dest, source) + strlen(source));
        strcpy(dest, buf);
        number++;
    }

    return number;
}


Ow divine.216, you'll love this piece of code - ha ha!

Update for no endless loops, smong, I lost the message in which you suggested better names for the variables, what were they?

Todo: Add overflow protection, as in: Probably add in int len to the parameters and add a check if an overflow would occur(Only possible if strlen dest>strlen source)[/b]
Anonymous - Mon May 03, 2004 11:07 am
Post subject:
I'll skip the critique of that code and say rather that if this kind of thing is going to be used (client macros) it would probably be much more elegant to have a module that lets you register and handles them systematically.
Anonymous - Wed Nov 24, 2004 6:29 pm
Post subject:
So yeah it's been 5 months and I forgot to upload this onto my website. Anyway here is a new version that can toggle lvz (for killer and arena), although I haven't tested it beyond compile errors.
Anonymous - Sat Apr 09, 2005 12:21 pm
Post subject:
Another update. I merged my macro expander in so the bongs can be defined on the same line as the message.
Quote:
Message2=%2%killer is on a spree (2:0)

Purge - Wed Jul 13, 2005 11:12 pm
Post subject:
ASSS is in C, so start there.
Dr Brain - Thu Jul 14, 2005 7:21 am
Post subject:
Whiskey Tango Foxtrot?
Purge - Thu Jul 14, 2005 11:19 am
Post subject:
Purge+ wrote:
I guess MGB deleted Quan's bump post...


I'm starting to sound like a moron with Quan's posts deleted. icon_sad.gif
tcsoccerman2 - Tue Mar 20, 2007 7:43 pm
Post subject: help
i know this is an old topic, but what would you do if you wanted to make the mesages appear at 5:0, 10:0, etc instead of 2,3,4:0. also, how owuld you make more messages appear for example up to 5:0. and not to be a nag, what if you want it to go up by 5's till 20(5,10,15,20:0) and then go up by ten's (30,40,50:0) ty so much. need this for my grand opening so yeh ty. great module btw:)

edit: figured all of that out (with common sense lol). now how do i get rid of default messages?? if i can't how do i change them? ty.
Dr Brain - Wed Mar 21, 2007 8:41 am
Post subject:
Are you using Siaon's or Smong's?
Animate Dreams - Wed Mar 21, 2007 11:55 am
Post subject:
He was using Smong's, but I already helped him, and he got everything figured out. I think his main problem was that he was using spree.conf, and then also declaring everything in arena.conf, so he couldn't delete default values easily(since they were being defined twice).
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group