mIRC Home    About    Download    Register    News    Help

Print Thread
a small request #237586 19/05/12 03:05 PM
Joined: Feb 2007
Posts: 91
S
spermis Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Feb 2007
Posts: 91
Hi guys.

I have a small request. Could someone make a little script for me, that would do the following:

If anyone in channel writes - "!start" , the bot says - Nick wants to play the game. Need atleast more 3 users.

Then if another player writes !start , the bot says - Nick wants to play the game. Need atleast more 2 users.

etc..
If from the moment the first player writes !start, after 5 minutes there are no atleast 4 players, the bot stops the registration, says - There werent enough users, and if anyone now writes !start, it would start from begining.

Also, if after the 5 minutes there are 4-5 players registered, the bot says - 4 player game is ON! and removes the 5th player (if there is one) who registered last , if there are 6-7 players then bot says 6 player game is ON! , and removes the 7th player who registered, and if the registered number reaches 8 , it automatically goes to 8 player game is ON! and stops the registration (8 players ir maximum) .

Hope that you understand me correct, and thanks! smile

Re: a small request [Re: spermis] #237590 20/05/12 02:54 AM
Joined: Mar 2004
Posts: 526
HorseC Offline
Fjord artisan
Offline
Fjord artisan
Joined: Mar 2004
Posts: 526
This is NOT a small request by any means. While this could be done, you should take the time to read the help sections for on text, setting variables, and setting timers. While there are many who could write this for you, this forum, in general, is for help with scripting problems in scripts the user asking has written, not a place to ask folks to do your work for you.


Help others! It makes the world a better place, Makes you feel good, and makes you Healthy!
Re: a small request [Re: spermis] #237599 20/05/12 04:18 PM
Joined: Feb 2007
Posts: 91
S
spermis Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Feb 2007
Posts: 91
I've managed to do it by myself smile Well, Im sure its pretty primitive, but it works for now smile any suggestions?

Code:

on *:start: {
  set %1slotsmax 8
  set %1slotsmin 4
  set %1slotsfree %1slotsmax
  set %1slotstaken 0
  set %1start1 x
  set %1start2 x
  set %1start3 x
  set %1start4 x
  set %1start5 x
  set %1start6 x
  set %1start7 x
  set %1start8 x
  set %time 5
  set %1startchannel #chan001
  set %1canstart 1
}
on *:TEXT:!start*:%1startchannel:{
  if (%1canstart != 1) { .notice $nick Game is not possible atm | halt }
  set %nick $nick
  if ($chr(124) isin $nick) { .notice $nick Invalid characters in nick! | halt }
  if (%1slotsfree == 0) { .notice $nick Game full | halt }
  if ($nick ison %1startchannel) { goto next }
  :next
  if (%1start1 == x) { set %1start1 %nick | timerstart 1 10 check | goto next2 }
  if (%1start2 == x) { set %1start2 %nick | goto next2 }
  if (%1start3 == x) { set %1start3 %nick | goto next2 }
  if (%1start4 == x) { set %1start4 %nick | goto next2 }
  if (%1start5 == x) { set %1start5 %nick | goto next2 }
  if (%1start6 == x) { set %1start6 %nick | goto next2 }
  if (%1start7 == x) { set %1start7 %nick | goto next2 }
  if (%1start8 == x) { set %1start8 %nick | goto next2 }
  :next2
  %1slotsfree = $calc(%1slotsfree - 1)
  %1slotstaken = $calc(%1slotsmax - %1slotsfree)
  %1slotsmore = $calc(%1slotsmin - %1slotstaken)
  if (%1slotstaken == %1slotsmax) { .msg %1startchannel Game is full! | timerstart off | check }
  msg %1startchannel %1slotstaken registered!
}

alias check {
  if (%1slotstaken == 8) { game8 }
  if (%1slotstaken == 7) { .notice %1start7 You have been removed from the game | game6 }
  if (%1slotstaken == 6) { game6 }
  if (%1slotstaken == 5) { .notice %1start5 You have been removed from the game | game4 }
  if (%1slotstaken == 4) { game4 }
  if (%1slotstaken < %1slotsmin) { .msg %1startchannel Not enough players! | unset | halt }
}

alias game8 {
  set %1canstart 0
  .msg %1startchannel 8 player game!
  .msg %1startchannel Players: %1start1 %1start2 %1start3 %1start4 %1start5 %1start6 %1start7 %1start8
}

alias game6 {
  set %1canstart 0
  .msg %1startchannel 6 player game!
  .msg %1startchannel Players: %1start1 %1start2 %1start3 %1start4 %1start5 %1start6
}

alias game4 {
  set %1canstart 0
  .msg %1startchannel 4 player game!
  .msg %1startchannel Players: %1start1 %1start2 %1start3 %1start4
}

alias unset {
  set %1slotsmax 8
  set %1slotsmin 4
  set %1slotsfree %1slotsmax
  set %1slotstaken 0
  set %1start1 x
  set %1start2 x
  set %1start3 x
  set %1start4 x
  set %1start5 x
  set %1start6 x
  set %1start7 x
  set %1start8 x
  set %1canstart 1
}