Author Topic: Map Randomizer  (Read 3211 times)

0 Members and 1 Guest are viewing this topic.

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Map Randomizer
« on: December 01, 2007, 07:05:38 am »
Script Name: Map Randomizer
Script Description: Loads a random map from the mapslist.txt and changes to that map at the end of each round.
Original Author(s): Avarax, uses xsplit by KeYDoN
Core Version: 2.6.3
Code:

An extract:
Code: [Select]
function GetRandomMap(forbidden: string): string;
var MapList: TStringArray;
    n,x: byte;
begin
  MapList:=xsplit(ReadFile('mapslist.txt'),chr(13)+chr(10));
  n:=GetArrayLength(MapList);
  If n > 0 then
    while true do begin
      x:=random(0,n-1);
      If MapList[x] <> forbidden then begin
        result:=MapList[x];
        exit;
      end;
    end
  else
    WriteLn('GetRandomMap fails: Empty mapslist.txt');
end;



Admin commands:
/randomize: Dis-/Enables map randomizer (default is enabled)
/randommap: Changes to a random map immediately




To install, simply extract into your dedicated server folder and activate scripting.
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Map Randomizer
« Reply #1 on: December 01, 2007, 09:28:29 am »
Small typo:
Quote
true : begin RandomMap:=true; WriteLn('Map randomizer disabled') WriteConsole(0,'Map randomizer disabled',$8FD2C4); end;
should be false

under OnCommand inside the case of

Offline PKS|Shooter

  • Soldier
  • **
  • Posts: 130
  • Dont fuck with us!
    • PKS - La Familia
Re: Map Randomizer
« Reply #2 on: December 01, 2007, 03:16:24 pm »
wtf :D U Rox Ava

Offline Iq Unlimited

  • Flagrunner
  • ****
  • Posts: 864
  • mr. foobar2000
Re: Map Randomizer
« Reply #3 on: December 01, 2007, 03:23:41 pm »
thank you for making this script better then the other crappy one. xD.

Offline poutch

  • Major(1)
  • Posts: 34
Re: Map Randomizer
« Reply #4 on: December 03, 2007, 05:47:03 pm »
You can also use a perl script if you dont  wan t to use the scriptcore ressources :

-----------------------
#!/usr/bin/perl
#randomize all lines of a file
#use ./randommaps.pl mapslist.txt >> newmapslist.txt
@array=<>;
for ($i=$#array;$i>0;$i--) {
  $j=int(rand($i));
  @array[$i,$j]=@array[$j,$i];
}
foreach $line (@array) {
  chomp($line);
  print("$line\n");
------------------------
www.pleez.fr .... coming soon

Offline Kavukamari

  • Camper
  • ***
  • Posts: 435
  • 3.14159265358979, mmm... pi
Re: Map Randomizer
« Reply #5 on: December 03, 2007, 08:24:24 pm »
thank you for making this script better then the other crappy one. xD.

err.. crappy one? do you mean the one I never finished?

(I tried!!!)
"Be mindful of fame, show a mighty courage, watch against foes. Nor shalt thou lack what thou desirest, if with thy life thou hast comest out from that heroic task."

Offline Iq Unlimited

  • Flagrunner
  • ****
  • Posts: 864
  • mr. foobar2000
Re: Map Randomizer
« Reply #6 on: December 04, 2007, 04:43:06 pm »
No, the one someone posted somewhere (Maybe here?) that picks a random map for you when you vote it. It didnt work that well for some reason...

Offline CaptainHighpants

  • Major(1)
  • Posts: 38
Re: Map Randomizer
« Reply #7 on: January 28, 2008, 10:04:50 pm »
Thank you. My server runs over 750 maps. This is perfect.

Offline ghg

  • Camper
  • ***
  • Posts: 411
  • Village Idiot
Re: Map Randomizer
« Reply #8 on: January 29, 2008, 02:07:18 am »
wtf :D U Rox Ava
lol teh speekz teh anooyz lawl wtf

(That txt-speak is annoying as hell)
-=Gradius wuz you=-

Offline Miszkol_

  • Major(1)
  • Posts: 30
  • The Piccolo Power xD
Re: Map Randomizer
« Reply #9 on: April 24, 2008, 03:26:20 pm »
@Avatarus

Can you do this script change <now map> to <random map> if is nextmap change time?? Example:

now map - kz_xXx
next map from maplist - kz_yYy
random map - kz_111

5...
4...
3...
2...
1...
[ * ]nextmap- KZ_111

Can you do it??
reply
English is hard language, please forget my bad :P

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Map Randomizer
« Reply #10 on: April 25, 2008, 01:31:19 am »
It already has that feature. It will change to a random map when the timer has reached 00:20.
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline Miszkol_

  • Major(1)
  • Posts: 30
  • The Piccolo Power xD
Re: Map Randomizer
« Reply #11 on: April 25, 2008, 02:00:31 am »
It already has that feature. It will change to a random map when the timer has reached 00:20.

No, because timer has reached 00:20, server load nextmap from maplist ;/
English is hard language, please forget my bad :P