Author Topic: Lonesome Self Fixer  (Read 5024 times)

0 Members and 1 Guest are viewing this topic.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Lonesome Self Fixer
« on: June 13, 2007, 11:43:31 am »
Script Name: Lonesome Self Fixer
Script Description: If you join with nobody else in the server, a random bot will join and entertain you until somebody else joins. If you leave, the bot gets kicked, so he won't wonder around in the server. Script works with both teamed and teamless gamestyles.
Original Author: Curt (DorkeyDear)
Core Version: 2.6.1
Code:
Code: [Select]
var
  Slot: byte;

procedure AddBot(Team: byte);
var
  i: byte;
begin
  Sleep(10);
  Slot := 0;
  i := 1;
  while (Slot = 0) and (i <= 32) do if GetPlayerStat(i,'Active') = false then Slot := i else i := i + 1;
  if (GameStyle = 0) or (GameStyle = 1) or (GameStyle = 4) then Command('/addbot ' + RandomBot) else Command('/addbot' + InttoStr(Team) + ' ' + RandomBot);
  BotChat(Slot,'Welcome! Sense there is nobody else here, so I''ll entertain you for a little while.');
end;

procedure OnJoinTeam(ID, Team: byte);
var
  BotTeam: byte;
begin
  if Team = 1 then BotTeam := 2 else BotTeam := 1;
  if GetPlayerStat(ID,'Human') = true then Case NumPlayers of
    1: if Slot = 0 then ThreadFunc([BotTeam],'AddBot');
    3: if (GetPlayerStat(Slot,'Human') = false) and (Slot <> 0) then KickPlayer(Slot);
  end;
end;

procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);
begin
  if (GetPlayerStat(ID,'Human') = true) and (NumPlayers = 2) and (Slot = 0) then ThreadFunc([Team],'AddBot');
  if (GetPlayerStat(ID,'Human') = true) and (GetPlayerStat(Slot,'Human') = false) and (Slot <> 0) then KickPlayer(Slot);
  if ID = Slot then Slot := 0;
end;
Note: The ThreadFunc procedure is sometimes buggy and the script may not always add the bot. It is usually buggy when it has a lot of stress (being called many times in small amount of time), and sense it is only called when your by your lonesome self, this shouldn't occur as often as other scripts.

Offline kornsick

  • Major(1)
  • Posts: 42
  • Fhtagn!
    • Soldat Server @ StarNet
Re: Lonesome Self Fixer
« Reply #1 on: June 13, 2007, 12:01:41 pm »
Um.. it says: "[Error] (60:1): Identifier Expected"
I used Soldat Script Combiner with template.
« Last Edit: June 13, 2007, 12:03:34 pm by kornsick »

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Lonesome Self Fixer
« Reply #2 on: June 13, 2007, 02:11:02 pm »
I tried to combine this with the template and it just says "Line #25 -> end;"
I'll check if its my error....

I manually combined a template with this script and it doesn't crash, and seems to work perfectly fine.
« Last Edit: June 13, 2007, 02:43:14 pm by DorkeyDear »

Offline mxyzptlk

  • Veteran
  • *****
  • Posts: 1493
  • The Panda Ninja
Re: Lonesome Self Fixer
« Reply #3 on: June 13, 2007, 02:25:45 pm »
So, when someone else joins, the bot is autokicked, as well?

"While preceding your entrance with a grenade is a good tactic in
Quake, it can lead to problems if attempted at work." -- C Hacking

Offline mikembm

  • Soldier
  • **
  • Posts: 210
Re: Lonesome Self Fixer
« Reply #4 on: June 13, 2007, 02:34:34 pm »
I tried to combine this with the template and it just says "Line #25 -> end;"
I'll check if its my error....

I manually combined a template with this script and it doesn't crash, and seems to work perfectly fine.

Oops. I wasn't anticipating people not starting a "case" statement on a new line.
Updated to fix that bug.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Lonesome Self Fixer
« Reply #5 on: June 13, 2007, 02:44:02 pm »
So, when someone else joins, the bot is autokicked, as well?
Yes. Also, if there are 2 humans, and 1 of them leaves, the bot will be added.

Offline kornsick

  • Major(1)
  • Posts: 42
  • Fhtagn!
    • Soldat Server @ StarNet
Re: Lonesome Self Fixer
« Reply #6 on: June 14, 2007, 11:37:12 am »
I combined it manually and it works... thank you.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Lonesome Self Fixer
« Reply #7 on: June 14, 2007, 07:22:09 pm »
This still should work in 2.6.2, but sense there is a new feature to the Command function (having a result), I'll be posting the 2.6.2 update here (to save a few lines of unneeded code). Sense its not out yet (at least I don't believe it is), I'll just post it, instead of editing my first post. I'll edit it (if i remember) when 2.6.2 comes out.
Code: [Select]
var
  Slot: byte;

procedure AddBot(Team: byte);
begin
  Sleep(10);
  if (GameStyle = 0) or (GameStyle = 1) or (GameStyle = 4) then Slot := Command('/addbot ' + RandomBot) else Slot := Command('/addbot' + InttoStr(Team) + ' ' + RandomBot);
  BotChat(Slot,'Welcome! Sense there is nobody else here, so I''ll entertain you for a little while.');
end;

procedure OnJoinTeam(ID, Team: byte);
var
  BotTeam: byte;
begin
  if Team = 1 then BotTeam := 2 else BotTeam := 1;
  if GetPlayerStat(ID,'Human') = true then Case NumPlayers of
    1: if Slot = 0 then ThreadFunc([BotTeam],'AddBot');
    3: if (GetPlayerStat(Slot,'Human') = false) and (Slot <> 0) then KickPlayer(Slot);
  end;
end;

procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);
begin
  if (GetPlayerStat(ID,'Human') = true) and (NumPlayers = 2) and (Slot = 0) then ThreadFunc([Team],'AddBot');
  if (GetPlayerStat(ID,'Human') = true) and (GetPlayerStat(Slot,'Human') = false) and (Slot <> 0) then KickPlayer(Slot);
  if ID = Slot then Slot := 0;
end;

Offline Martino

  • Major(1)
  • Posts: 18
Re: Lonesome Self Fixer
« Reply #8 on: July 22, 2007, 02:12:56 am »
I think that same function is in server.ini. It's called botbalance but I' m not sure if it kicks bots too.

Offline Iq Unlimited

  • Flagrunner
  • ****
  • Posts: 864
  • mr. foobar2000
Re: Lonesome Self Fixer
« Reply #9 on: July 22, 2007, 02:18:11 am »
This is perhaps the saddest code I have ever seen. If your alone in a server then you have no friends xD.

I think that same function is in server.ini. It's called botbalance but I' m not sure if it kicks bots too.
Yes it is basically the same, and yes it does kick the bots.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Lonesome Self Fixer
« Reply #10 on: July 23, 2007, 11:29:05 am »
oh, i never saw that there b4 :P now what a pointless script i have just made. i think its buggy too, lol

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: Lonesome Self Fixer
« Reply #11 on: July 24, 2007, 11:02:39 am »
wot?  There's a botbalance function?  haha i never knew that!
Sry DD... I hate when that happens...
Can't think of anything original to put here...

Offline noerrorsfound

  • Major(1)
  • Posts: 17
Re: Lonesome Self Fixer
« Reply #12 on: July 26, 2007, 10:48:10 am »
This is perhaps the saddest code I have ever seen. If your alone in a server then you have no friends xD.
That isn't true at all. Sometimes the servers with the lowest pings (ping depends on distance between you and the server as well as connection) are empty, and instead of going into a server you know you'll lag in, it's better to go to one with a lower ping and stay for a while to see if someone else joins. Sadly, many people don't do this because being in a server by yourself is boring, and people usually won't join right away.

Offline Dizzy So 1337

  • Soldier
  • **
  • Posts: 246
Re: Lonesome Self Fixer
« Reply #13 on: August 02, 2007, 12:56:59 am »
wot?  There's a botbalance function?  haha i never knew that!
Sry DD... I hate when that happens...

FFS!  When did this happen?

I set botbalanceteams=1 in server.ini on my TM server.  Nothing happened.  Help?

ALSO: for the original scriptwriter, hey, maybe there's still gold in your script.  Could you make it so that it adds one bot, you kill him, and it adds 2, you kill them, it adds 3... etc... resets when you die, and you play it for high score.  Or something... anyways, just tryin to cheer u up.
« Last Edit: August 02, 2007, 01:11:22 am by Dizzy So 1337 »
xfire - todhostetler
"There's nothing I wouldn't do to win. But I never hurt anyone except to stick a dogskull on a stake."

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Lonesome Self Fixer
« Reply #14 on: August 02, 2007, 07:15:05 pm »
for the original scriptwriter, hey, maybe there's still gold in your script.  Could you make it so that it adds one bot, you kill him, and it adds 2, you kill them, it adds 3... etc... resets when you die, and you play it for high score.  Or something... anyways, just tryin to cheer u up.
Possible... Could make a whole single-player server just on this.. lol, or multiplayer, except it should be very limited to # of people, sense max players is 32 and bots are sometimes kind of easy to kill, so once 2 people hits 10 bots, that means there are only 9 bot slots left for the third player, if the first 2 don't get any more wins... lol..
I would but.. who would actually use it? (I have doubts that people are using my scripts (excluding this 1, sense im pretty sure its buggy, but maybe if I actually see a demand for the script to work :P that might make me work on it.. lol)) plus I have like 100 other things to finish up first.

Offline Dizzy So 1337

  • Soldier
  • **
  • Posts: 246
Re: Lonesome Self Fixer
« Reply #15 on: August 02, 2007, 07:59:18 pm »
FFS!  When did this happen?

I set botbalanceteams=1 in server.ini on my TM server.  Nothing happened.  Help?


Help please?
xfire - todhostetler
"There's nothing I wouldn't do to win. But I never hurt anyone except to stick a dogskull on a stake."

Offline 1221995

  • Soldier
  • **
  • Posts: 206
Re: Lonesome Self Fixer
« Reply #16 on: August 04, 2007, 06:18:53 am »
I Like the script. it looks good.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Lonesome Self Fixer
« Reply #17 on: August 04, 2007, 11:09:32 am »
I Like the script. it looks good.
I think its bugged. I remember getting it to work before when I made this, but somethign must not be right because I remember like a week ago, I tried putting this onto a server, and the bot joined, then got kicked :P was weird... hopefully ill try to redo this script to make it work.

Offline nuclearrambo

  • Major
  • *
  • Posts: 76
Re: Lonesome Self Fixer
« Reply #18 on: August 10, 2007, 07:14:08 am »
this script has a lot of errors and bugs. plz check it up

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Lonesome Self Fixer
« Reply #19 on: August 10, 2007, 12:26:24 pm »
i think its buggy too
i know, i've been too lazy to fix.