[nexuiz-commits] r7012 - trunk/misc/tools

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Jun 12 14:51:18 EDT 2009


Author: div0
Date: 2009-06-12 14:51:18 -0400 (Fri, 12 Jun 2009)
New Revision: 7012

Added:
   trunk/misc/tools/midi2cfg-ng-simple.conf
Modified:
   trunk/misc/tools/midi2cfg-ng.conf
   trunk/misc/tools/midi2cfg-ng.pl
Log:
use dynamic place assignment


Added: trunk/misc/tools/midi2cfg-ng-simple.conf
===================================================================
--- trunk/misc/tools/midi2cfg-ng-simple.conf	                        (rev 0)
+++ trunk/misc/tools/midi2cfg-ng-simple.conf	2009-06-12 18:51:18 UTC (rev 7012)
@@ -0,0 +1,384 @@
+bot tuba
+	channels 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16
+	init
+		cmd barrier
+		cmd selectweapon 16
+		cmd wait 0.5
+		cmd console "g_balance_tuba_attenuation 0.1"
+		cmd console "g_balance_tuba_damage 0"
+	note on -18
+		time -0.05
+		buttons left backward crouch
+		time 0
+		buttons attack1 left backward crouch
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on -17
+		time -0.05
+		buttons backward crouch
+		time 0
+		buttons attack1 backward crouch
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on -16
+		time -0.05
+		buttons backward right crouch
+		time 0
+		buttons attack1 backward right crouch
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on -13
+		time -0.05
+		buttons forward right crouch
+		time 0
+		buttons attack1 forward right crouch
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on -12
+		time -0.05
+		buttons crouch
+		time 0
+		buttons attack1 crouch
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on -11
+		time -0.05
+		buttons left backward crouch
+		time 0
+		buttons attack2 left backward crouch
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on -10
+		time -0.05
+		buttons right crouch
+		time 0
+		buttons attack1 right crouch
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on -9
+		time -0.05
+		buttons forward left crouch
+		time 0
+		buttons attack1 forward left crouch
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on -8
+		time -0.05
+		buttons forward crouch
+		time 0
+		buttons attack1 forward crouch
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on -7
+		time -0.05
+		buttons left crouch
+		time 0
+		buttons attack1 left crouch
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on -6
+		time -0.05
+		buttons left backward
+		time 0
+		buttons attack1 left backward
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on -5
+		time -0.05
+		buttons backward
+		time 0
+		buttons attack1 backward
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on -4
+		time -0.05
+		buttons backward right
+		time 0
+		buttons attack1 backward right
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on -3
+		time -0.05
+		buttons right crouch
+		time 0
+		buttons attack2 right crouch
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on -2
+		time -0.05
+		buttons forward left crouch
+		time 0
+		buttons attack2 forward left crouch
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on -1
+		time -0.05
+		buttons forward right
+		time 0
+		buttons attack1 forward right
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 0
+		time -0.05
+		buttons
+		time 0
+		buttons attack1
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 1
+		time -0.05
+		buttons left backward
+		time 0
+		buttons attack2 left backward
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 2
+		time -0.05
+		buttons right
+		time 0
+		buttons attack1 right
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 3
+		time -0.05
+		buttons forward left
+		time 0
+		buttons attack1 forward left
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 4
+		time -0.05
+		buttons forward
+		time 0
+		buttons attack1 forward
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 5
+		time -0.05
+		buttons left
+		time 0
+		buttons attack1 left
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 6
+		time -0.05
+		buttons forward right
+		time 0
+		buttons attack2 forward right
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 7
+		time -0.05
+		buttons
+		time 0
+		buttons attack2
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 8
+		time -0.05
+		buttons backward right jump
+		time 0
+		buttons attack1 backward right jump
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 9
+		time -0.05
+		buttons right
+		time 0
+		buttons attack2 right
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 10
+		time -0.05
+		buttons forward left
+		time 0
+		buttons attack2 forward left
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 11
+		time -0.05
+		buttons forward
+		time 0
+		buttons attack2 forward
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 12
+		time -0.05
+		buttons left
+		time 0
+		buttons attack2 left
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 13
+		time -0.05
+		buttons left backward jump
+		time 0
+		buttons attack2 left backward jump
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 14
+		time -0.05
+		buttons right jump
+		time 0
+		buttons attack1 right jump
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 15
+		time -0.05
+		buttons forward left jump
+		time 0
+		buttons attack1 forward left jump
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 16
+		time -0.05
+		buttons forward jump
+		time 0
+		buttons attack1 forward jump
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 17
+		time -0.05
+		buttons left jump
+		time 0
+		buttons attack1 left jump
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 18
+		time -0.05
+		buttons forward right jump
+		time 0
+		buttons attack2 forward right jump
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 19
+		time -0.05
+		buttons jump
+		time 0
+		buttons attack2 jump
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 21
+		time -0.05
+		buttons right jump
+		time 0
+		buttons attack2 right jump
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 22
+		time -0.05
+		buttons forward left jump
+		time 0
+		buttons attack2 forward left jump
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 23
+		time -0.05
+		buttons forward jump
+		time 0
+		buttons attack2 forward jump
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+	note on 24
+		time -0.05
+		buttons left jump
+		time 0
+		buttons attack2 left jump
+		time 0.05
+		buttons
+		time 0.1
+		busy 0.25
+
+bot tuba_red
+	include tuba
+	count 256
+	transpose 0
+	init
+		cmd cc "color 68"
+		super 
+
+bot tuba_blue
+	include tuba
+	count 256
+	transpose 3
+	init
+		cmd cc "color 221"
+		super 

Modified: trunk/misc/tools/midi2cfg-ng.conf
===================================================================
--- trunk/misc/tools/midi2cfg-ng.conf	2009-06-12 18:51:04 UTC (rev 7011)
+++ trunk/misc/tools/midi2cfg-ng.conf	2009-06-12 18:51:18 UTC (rev 7012)
@@ -1,3 +1,6 @@
+raw set places_tuba "tUba1 tUba2 tUba3 tUba4 tUba5 tUba6 tUba7 tUba8 tUba9 tUba10 tUba11 tUba12 tUba13 tUba14 tUba15 tUba16"
+raw set places_percussion "tChr11 tChr12 tChr21 tChr22 tChr23 tChr31 tChr32 tChr33 tChr41 tChr42 tChr43 tChr44"
+
 bot tuba
 	channels 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16
 	init
@@ -564,284 +567,122 @@
 
 # instantiate our bots!
 
-bot tuba1
+bot instance_tuba_red
 	include tuba_red
-	count 1
+	count 16
 	init
-		cmd movetotarget tUba1
+		cmd movetotarget $places_tuba
 		cmd barrier
 		super
 	done
 		cmd movetotarget goaway
 
-bot tuba2
+bot instance_tuba_blue
 	include tuba_blue
-	count 1
+	count 16
 	init
-		cmd movetotarget tUba2
+		cmd movetotarget $places_tuba
 		cmd barrier
 		super
 	done
 		cmd movetotarget goaway
 
-bot tuba3
-	include tuba_red
+bot instance_rocket
+	include rocket
 	count 1
 	init
-		cmd movetotarget tUba3
+		cmd movetotarget $places_percussion
 		cmd barrier
 		super
 	done
 		cmd movetotarget goaway
 
-bot tuba4
-	include tuba_blue
-	count 1
+bot instance_uzi
+	include uzi
+	count 2
 	init
-		cmd movetotarget tUba4
+		cmd movetotarget $places_percussion
 		cmd barrier
 		super
 	done
 		cmd movetotarget goaway
 
-bot tuba5
-	include tuba_red
-	count 1
+bot instance_crylink
+	include crylink
+	count 2
 	init
-		cmd movetotarget tUba5
+		cmd movetotarget $places_percussion
 		cmd barrier
 		super
 	done
 		cmd movetotarget goaway
 
-bot tuba6
-	include tuba_blue
-	count 1
-	init
-		cmd movetotarget tUba6
-		cmd barrier
-		super
-	done
-		cmd movetotarget goaway
-
-bot tuba7
-	include tuba_red
-	count 1
-	init
-		cmd movetotarget tUba7
-		cmd barrier
-		super
-	done
-		cmd movetotarget goaway
-
-bot tuba8
-	include tuba_blue
-	count 1
-	init
-		cmd movetotarget tUba8
-		cmd barrier
-		super
-	done
-		cmd movetotarget goaway
-
-bot tuba9
-	include tuba_red
-	count 1
-	init
-		cmd movetotarget tUba9
-		cmd barrier
-		super
-	done
-		cmd movetotarget goaway
-
-bot tuba10
-	include tuba_blue
-	count 1
-	init
-		cmd movetotarget tUba10
-		cmd barrier
-		super
-	done
-		cmd movetotarget goaway
-
-bot tuba11
-	include tuba_red
-	count 1
-	init
-		cmd movetotarget tUba11
-		cmd barrier
-		super
-	done
-		cmd movetotarget goaway
-
-bot tuba12
-	include tuba_blue
-	count 1
-	init
-		cmd movetotarget tUba12
-		cmd barrier
-		super
-	done
-		cmd movetotarget goaway
-
-bot tuba13
-	include tuba_red
-	count 1
-	init
-		cmd movetotarget tUba13
-		cmd barrier
-		super
-	done
-		cmd movetotarget goaway
-
-bot tuba14
-	include tuba_blue
-	count 1
-	init
-		cmd movetotarget tUba14
-		cmd barrier
-		super
-	done
-		cmd movetotarget goaway
-
-bot tuba15
-	include tuba_red
-	count 1
-	init
-		cmd movetotarget tUba15
-		cmd barrier
-		super
-	done
-		cmd movetotarget goaway
-
-bot tuba16
-	include tuba_blue
-	count 1
-	init
-		cmd movetotarget tUba16
-		cmd barrier
-		super
-	done
-		cmd movetotarget goaway
-
-# percussion bots:
-
-bot chair11
-	include rocket
-	count 1
-	init
-		cmd movetotarget tChr11
-		cmd barrier
-		super
-	done
-		cmd movetotarget goaway
-
-bot chair12
-	include electro
-	count 1
-	init
-		cmd movetotarget tChr12
-		cmd barrier
-		super
-	done
-		cmd movetotarget goaway
-
-bot chair21
+bot instance_jetpack
 	include jetpack
-	count 1
+	count 2
 	init
-		cmd movetotarget tChr21
+		cmd movetotarget $places_percussion
 		cmd barrier
 		super
 	done
 		cmd movetotarget goaway
 
-bot chair22
-	include uzi
-	count 1
+bot instance_jump
+	include jump
+	count 0
 	init
-		cmd movetotarget tChr22
+		cmd movetotarget $places_percussion
 		cmd barrier
 		super
 	done
 		cmd movetotarget goaway
 
-bot chair23
-	include jetpack
-	count 1
+bot instance_hagar
+	include hagar
+	count 4
 	init
-		cmd movetotarget tChr23
+		cmd movetotarget $places_percussion
 		cmd barrier
 		super
 	done
 		cmd movetotarget goaway
 
-bot chair31
+bot instance_tag
 	include tag
-	count 1
+	count 4
 	init
-		cmd movetotarget tChr31
+		cmd movetotarget $places_percussion
 		cmd barrier
 		super
 	done
 		cmd movetotarget goaway
 
-bot chair32
-	include tag
-	count 1
+bot instance_laser
+	include laser
+	count 4
 	init
-		cmd movetotarget tChr32
+		cmd movetotarget $places_percussion
 		cmd barrier
 		super
 	done
 		cmd movetotarget goaway
 
-bot chair33
-	include tag
+bot instance_electro
+	include electro
 	count 1
 	init
-		cmd movetotarget tChr33
+		cmd movetotarget $places_percussion
 		cmd barrier
 		super
 	done
 		cmd movetotarget goaway
 
-bot chair41
+bot instance_hook
 	include hook
-	count 1
+	count 2
 	init
-		cmd movetotarget tChr41
+		cmd movetotarget $places_percussion
 		cmd barrier
 		super
 	done
 		cmd movetotarget goaway
-
-bot chair42
-	include hagar
-	count 1
-	init
-		cmd movetotarget tChr42
-		cmd barrier
-		super
-	done
-		cmd movetotarget goaway
-
-bot chair43
-	include laser
-	count 1
-	init
-		cmd movetotarget tChr43
-		cmd barrier
-		super
-	done
-		cmd movetotarget goaway
-
-bot chair44
-	include jetpack
-	count 0
-	init
-		cmd movetotarget tChr44
-		cmd barrier
-		super
-	done
-		cmd movetotarget goaway

Modified: trunk/misc/tools/midi2cfg-ng.pl
===================================================================
--- trunk/misc/tools/midi2cfg-ng.pl	2009-06-12 18:51:04 UTC (rev 7011)
+++ trunk/misc/tools/midi2cfg-ng.pl	2009-06-12 18:51:18 UTC (rev 7012)
@@ -13,9 +13,9 @@
 use constant MIDI_FIRST_NONCHANNEL => 17;
 use constant MIDI_DRUMS_CHANNEL => 10;
 
-die "Usage: $0 filename.mid transpose timeoffset timeoffset2 timeoffset3 timeoffset4 preallocatedbots..."
-	unless @ARGV >= 6;
-my ($filename, $transpose, $timeoffset, $timeoffset2, $timeoffset3, $timeoffset4, @preallocate) = @ARGV;
+die "Usage: $0 filename.conf filename.mid transpose timeoffset timeoffset2 timeoffset3 timeoffset4 preallocatedbots..."
+	unless @ARGV >= 7;
+my ($config, $filename, $transpose, $timeoffset, $timeoffset2, $timeoffset3, $timeoffset4, @preallocate) = @ARGV;
 
 my $opus = MIDI::Opus->new({from_file => $filename});
 #$opus->write_to_file("/tmp/y.mid");
@@ -180,6 +180,10 @@
 		{
 			$currentbot = ($bots{$1} ||= {count => 0, transpose => 0});
 		}
+		elsif(/^raw (.*)/)
+		{
+			printf "$1\n";
+		}
 		else
 		{
 			print "unknown command: $_\n";
@@ -306,7 +310,6 @@
 	{
 		return 0
 			if not busybot_cmd_bot_test $bot, $time + $notetime, @$cmds; 
-		busybot_cmd_bot_execute $bot, 0, ['cmd', 'barrier_init'];
 		busybot_cmd_bot_execute $bot, 0, ['cmd', 'wait', $timeoffset];
 		busybot_cmd_bot_execute $bot, 0, ['cmd', 'barrier'];
 		busybot_cmd_bot_execute $bot, 0, @{$bot->{init}}
@@ -324,7 +327,7 @@
 	return 1;
 }
 
-my $busybots = botconfig_read "midi2cfg-ng.conf";
+my $busybots = botconfig_read $config;
 my @busybots_allocated;
 my %notechannelbots;
 
@@ -406,7 +409,6 @@
 	my $bot = Storable::dclone $busybots->{$_};
 	$bot->{id} = @busybots_allocated + 1;
 	$bot->{classname} = $_;
-	busybot_cmd_bot_execute $bot, 0, ['cmd', 'barrier_init'];
 	busybot_cmd_bot_execute $bot, 0, ['cmd', 'wait', $timeoffset];
 	busybot_cmd_bot_execute $bot, 0, ['cmd', 'barrier'];
 	busybot_cmd_bot_execute $bot, 0, @{$bot->{init}}



More information about the nexuiz-commits mailing list