mIRC Home    About    Download    Register    News    Help

Print Thread
#109228 26/01/05 09:47 PM
Joined: Dec 2004
Posts: 18
S
sylain Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Dec 2004
Posts: 18
first question: what is the 'command' or whatever for "greater than or equal to" ?
ie:
Code:
  if (% $+ $nick $+ _Points  >=  0)


second question:
I use I account for 'referee' or 'bot' or whatever, so I can't touch the point system, but whenever someone besides me enters a command I have in the game, I reply to it as well as the bot
ie
Quote:
random user: !point totals
sylain: random user's points are...
tester: random user's points are...

I don't want to say it, just the bot.

question three: How do I delay a remote script thing?
Some of the commands cause me to overflow/spam and I get kicked...


Any help to solve these problems is really appreciated.
Thanks guys!

#109229 26/01/05 10:37 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
(1) if (% [ $+ [ $nick ] $+ ] _Points >= 0), the >= was right, the compiling the variable name needed some evaluation order braces.

(2) Dont connect with the same Mirc the bot is using, if your not, then unload the bot scripts from the second mirc. If its your bot script, add a check that $me == %botname, then set %botname

(3) .timer 1 N command here, N is a delay in seconds before command is entered /help /timer, this byno means is the only way, /play is another.

#109230 26/01/05 10:40 PM
Joined: Dec 2004
Posts: 18
S
sylain Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Dec 2004
Posts: 18
Quote:
(1) if (% [ $+ [ $nick ] $+ ] _Points >= 0), the >= was right, the compiling the variable name needed some evaluation order braces.

(2) Dont connect with the same Mirc the bot is using, if your not, then unload the bot scripts from the second mirc. If its your bot script, add a check that $me == %botname, then set %botname

(3) .timer 1 N command here, N is a delay in seconds before command is entered /help /timer, this byno means is the only way, /play is another.
Wow, thanks ^^
I'm gonna go try it out and see what I can do...

#109231 26/01/05 10:54 PM
Joined: Dec 2004
Posts: 18
S
sylain Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Dec 2004
Posts: 18
it worked really well! Thanks ^^
and now...the last question(s)
1. how can I generate a random integer? (for use in points, like, awards randomly between 1 and... 10 points)
2. How do I make it so the user can only repeat one of my commands like, once every ten seconds?
as in
[quote]<someone> !up person
<sylain> not yet...wait a minute
[/code]

*edit*
also, What other versions of mIRC are recommended for using a bot? I mean, I only have one version, and I start it up twice, one for me, one for the bot; but that doesn't work (obviously :-P )

Last edited by sylain; 26/01/05 11:05 PM.
#109232 26/01/05 11:59 PM
Joined: Nov 2004
Posts: 332
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Nov 2004
Posts: 332
your aware of the redundancy of making a antiflood measure of one sort or another and then attaching a "unavailalble" message to it


The Kodokan will move you, one way or another.
#109233 27/01/05 03:39 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
(1) $rand(1,10)

(2) when a user inits a command set a variable something like " set -u10 %Commands.deny. [ $+ [ $nick ] ] $true " that set well expire in 10 seconds so exists for only 10 seconds.
in the begining of each of your commands you check if this is not set " IF ( !%commands.deny. [ $+ [ $nick ] ] ) { command code in here } ", so you would have something like this...
Code:
ON *:TEXT:!blah:#:{
  IF ( !%commands.deny. [ $+ [ $nick ] ] ) {
    set -u10 %Commands.deny. [ $+ [ $nick ] ] $true 
    ....
    .... the actual commands to the event ...
    ....
  }
}

In some situations the variable which is %Commands.deny.nickname must be written as follows %Commands.deny. [ $+ [ $nick ] ] at other times it can be written %Commands.deny. $+ $nick for instance the set -u10 %Commands.deny. [ $+ [ $nick ] ] $true can actuially be written as set -u10 %Commands.deny. $+ $nick $true.
The rule i beleive is if you are declearing something then you dont need any [ ], if your accessing it such as in the IF statment then they are needed, I leave them in both since then the variable is easy to see as the same thing, this is of course personal choice.
PS: Do not put in a message to wait if they cant enter a command it well just cause u to be flooding the channel with messages.

(3), the latest version is a good version to be running, i wouldnt advise running two instances of mirc from the same folder, this is why your second nick is also running the bot, you simply need to install mirc a second time into a second folder, in fact you can just copy the original folder to a new location, and run the second nick from there, (unload the bot from it tho!)

#109234 27/01/05 04:16 AM
Joined: Dec 2004
Posts: 18
S
sylain Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Dec 2004
Posts: 18
Code:
 ;GAME EXPERIMENTAL
on *:text:!join:#: {
  set % $+ $nick $+ _Ammo 6
  set % $+ $nick $+ _Health 120
  set % $+ $nick $+ _Exp 0
  set % $+ $nick $+ _Kills 0
  set % $+ $nick $+ _Deaths 0
  msg #test $nick has joined the fray!
}

on *:text:!shoot*:#: { 
if ( % [ $+ [ $nick ] $+ ] _Health &lt;= 1) {
     msg #test $nick, you're DEAD.  }
   elseif ( % [ $+ [ $nick ] $+ ] _Ammo &gt;= 0) {
     dec % $+ $nick $+ _Ammo 1
     if ( % [ $+ [ $$2 ] $+ ] _Health &lt;= 1) {
       msg #test $nick shot $$2's dead corpse. }
     else {
       msg #test $nick shot $$2 in the face! 
       dec % $+ $$2 $+ _Health $rand(10,30) 
       if ( % [ $+ [ $$2 ] $+ ] _Health &lt;= 1) {
         msg #test $nick KILLED $$2!
         dec % $+ $$2 $+ _Exp 1
         inc % $+ $nick $+ _Exp 3 
       }
     }
     elseif ( % [ $+ [ $nick ] $+ ] _Ammo = 0) {
       msg #test $nick, reload, moron! }
     else {
       msg #test join the game first!  }
     }
 }

on *:text:!respawn:#: {
  if ( % [ $+ [ $nick ] $+ ] _Health &gt;= 1) {
    msg #test wait until you're dead! 
  }
  else {
    set % $+ $nick $+ _Health 120
    msg #test $nick is back in the game! 
  }
}
on *:text:!reload:#: {
  % $+ $nick $+ _ammo = 6
  msg #test $nick's ready to go!
}
on *:text:!stats:#: {
  msg #test stats for $nick : Kills: $eval(% $+ $nick $+ _Kills,2), Deaths: $eval(% $+ $nick $+ _Deaths,2), and experience: $eval(% $+ $nick $+ _Exp,2)
}
on *:text:!commands:#: {
 msg #test command list: "join" sets you up.
 msg #test "!shoot *target*" uses one of your bullets to shoot the target, duh.
 msg #test "!reload" reloads your weapon; "!respawn" revives you.
 msg #test "!stats" shows your statistics, and "!suicide" removes you from the game.
}
on *:text:!suicide:#: {
  set % $+ $nick $+ _Ammo 0
  set % $+ $nick $+ _Health 0
  set % $+ $nick $+ _Exp 0
  set % $+ $nick $+ _Kills 0
  set % $+ $nick $+ _Deaths 0
  msg #test $nick is officially DEAD. } 

that's the basis for the coding for the game I'm trying to create... how can I put the timer in the shooting command so you can't be shot as soon as you revive?

also, are there any improvements?

#109235 27/01/05 06:05 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Wow this looks like a fun channel game to play, i can see people just blazing away for hours on each other.
I have left it using global variables , although you should really look into using a hash table, dont let the fact its a hash table concern you, in a simple way there just like a set of variables held in a special box (the hashtable), you would replace set % $+ $nick $+ _ammo 6 with hadd -m shotgame $nick $+ _ammo 6 and accesing would change from % [ $+ [ $nick ] $+ ] _ammo into $hget(shotgame,$nick $+ _ammo) but that might be for a latter version.


OK things i did, and i hope u dont mind some of the small additions, just saw something that might be a little nicer, adjust as you like its your script.


(1*) changed the ON *:TEXT:!trigger:# to being ON *:TEXT:!trigger:#channelname, you need to change this to the channel your running it on, so the bot if in another channel wont take instructions from there, alos with this, I replaced all the MSG #TEST with MSG $CHAN whcih is the channel that the bot responds to.

(2*) each event now checks for if the player is in the game, and gives a relevent responce if needed and halts. This is the first IF line with the ; lines around it.

(3) I added a -u10000000 to all the sets, this means there global but not saved if mirc exits, If u do want them saved, so the game continues when u return with players intacked then just remove the -u10000000, 5 in !join and 1 in !respawn

(4) added some checks if !shoot $2 had no $2, shoots thin air or if $2 isnt playing etc

(5*) added a reviving player detection this gives a !respaned player 5 seconds of invincibility, see * added the reviving detector * and * added the reviving detector flag (5 seconds duration) *

(6) added a shoot in different places remark

(7) added a shoting with no bullets joke, click, click, click, reload moron

(8) added ability to !stats anynick (as long as there in the game)

(9*) on a !suicide correctly UNSET the variables

(10) added an alias for you to nukem all

(N*) I beleive the ones with * above are the critical ones, the others i added (hope u dont mind again) as i beleive it would make the game better.


Code:
;GAME EXPERIMENTAL
on *:text:!join:#channelname: {
  ;
  if ($var(% [ $+ [ $nick ] $+ ] _Ammo,0)) { msg $chan $nick has attempted to join the fray when hes already in it, everyone shoot him quick! | halt }
  ;
  set -u10000000 % $+ $nick $+ _Ammo 6
  set -u10000000 % $+ $nick $+ _Health 120
  set -u10000000 % $+ $nick $+ _Exp 0
  set -u10000000 % $+ $nick $+ _Kills 0
  set -u10000000 % $+ $nick $+ _Deaths 0
  msg $chan $nick has joined the fray!
}
;
on *:text:!shoot*:#channelname: { 
  ;
  if (!$var(% [ $+ [ $nick ] $+ ] _Ammo,0)) { msg $chan $nick join the game first! | halt }
  ;
  if ( % [ $+ [ $nick ] $+ ] _Health &lt;= 1)  {
    msg $chan $nick, you're DEAD.
  }
  elseif ( % [ $+ [ $nick ] $+ ] _Ammo &gt; 0) {
    dec % $+ $nick $+ _Ammo 1
    if ($2 == $null) {
      msg $chan $nick shoots into thin air, wow good move there!
    }
    elseif (!$var(% [ $+ [ $2 ] $+ ] _Ammo,0)) {
      msg $chan $nick shoots $2 to bad hes not in the game!
    }
    ;
    ;^ **** added some checks for $2 being nothing or a non playing name ****
    ;
    elseif ( % [ $+ [ $2 ] $+ ] _Health &lt;= 1) {
      msg $chan $nick shot $$2 $+ 's dead corpse.
    }
    else {
      if ( % [ $+ [ $nick ] $+ ] _reviving ) {
        msg $chan $nick shot at $2 but $2 being fully healthy and alert dodged the bullet.
      }
      ;
      ;^ ***** added the reviving detector *****
      ;
      else {

        msg $chan $nick shot $2 in the $gettok( face! / body! / leg! / hand (ouch!) / foot?!? LoL! / back! (you swine!) / Balls (now that gotta hurt),$rand(1,7),47)
        ;
        ;^ ***** added a multiple shot spots sepreate each with a / and make $rand(1,N) N being how many you have. *****
        ;
        dec % $+ $2 $+ _Health $rand(10,30) 
        if ( % [ $+ [ $2 ] $+ ] _Health &lt;= 1) {
          msg $chan $nick KILLED $2 $+ !
          dec % $+ $$2 $+ _Exp 1
          inc % $+ $nick $+ _Exp 3 
        }
      }
    }
  }
  elseif ( % [ $+ [ $nick ] $+ ] _Ammo &lt;= 0) {
    msg $chan $nick click 
    dec % $+ $nick $+ _Ammo 1
    if ( % [ $+ [ $nick ] $+ ] _Ammo &lt; -2) {
      msg $chan $nick $+ , reload, moron!
    }
    ;
    ;^ ***** added a little hummor when there outta ammo *****
    ;
  }
}
;
on *:text:!respawn:#channelname: {
  ;
  if (!$var(% [ $+ [ $nick ] $+ ] _Ammo,0)) { msg $chan $nick join the game first! | halt }
  ;
  if ( % [ $+ [ $nick ] $+ ] _Health &gt;= 1) {
    msg $chan wait until you're dead! 
  }
  else {
    set -u10000000 % $+ $nick $+ _Health 120
    msg $chan $nick is back in the game!
    set -u5 % $+ $nick $+ _reviving $true
    ;
    ;^ ***** added the reviving detector flag (5 seconds duration) *****
    ;
  }
}
;
on *:text:!reload:#channelname: {
  ;
  if (!$var(% [ $+ [ $nick ] $+ ] _Ammo,0)) { msg $chan $nick join the game first! | halt }
  ;
  % $+ $nick $+ _ammo = 6
  msg $chan $nick's ready to go!
}
;
on *:text:!stats:#channelname: {
  ;
  if (!$var(% [ $+ [ $nick ] $+ ] _Ammo,0)) { msg $chan $nick join the game first! | halt }
  ;
  if (!$2) { tokenize 32 !stats $nick }
  if (!$var(% [ $+ [ $2 ] $+ ] _Ammo,0)) {
    msg $chan $nick $2 isnt in the game.
  }
  else {  
    msg $chan stats for $2 : Kills: $eval(% $+ $2 $+ _Kills,2), Deaths: $eval(% $+ $2 $+ _Deaths,2), and experience: $eval(% $+ $2 $+ _Exp,2)
  }
  ;
  ;^ ***** added ability to !stats anynick *****
  ;
}
;
on *:text:!suicide:#channelname: {
  if (!$var(% [ $+ [ $nick ] $+ ] _Ammo,0)) { msg $chan $nick join the game first! | halt }
  ;
  unset % $+ $nick $+ _Ammo
  unset % $+ $nick $+ _Health
  unset % $+ $nick $+ _Exp
  unset % $+ $nick $+ _Kills
  unset % $+ $nick $+ _Deaths
  msg $chan $nick is officially DEAD.
}
;
on *:text:!commands:#channelname: {
  msg $chan command list: "!join" sets you up.
  msg $chan "!shoot *target*" uses one of your bullets to shoot the target, duh.
  msg $chan "!reload" reloads your weapon; "!respawn" revives you.
  msg $chan "!stats" shows your statistics, and "!suicide" removes you from the game.
}
;
alias nukem {
  ;
  ;^ ***** added an alias you can use to erase all players *****
  ;
  unset %*_Ammo
  unset %*_Health
  unset %*_Exp
  unset %*_Kills
  unset %*_Deaths
  say A small nuke was just deployed, resulting in the vaperization of all players, Long Live $me!
}


[edit]
Please note while I wrote that up in the script editor I didnt debug it in play, (ie didnt go in and play the game using nicks)

Last edited by DaveC; 27/01/05 06:07 AM.
#109236 28/01/05 04:51 PM
Joined: Mar 2004
Posts: 96
G
Babel fish
Offline
Babel fish
G
Joined: Mar 2004
Posts: 96
I tested it out as I thought it would be a interesting game. Noticed two error, from as far as I got into the game.

1) the nukem bit wont show the $me! part beacause of the !. Change it to $me $+ ! to make it work.

2) Can't reload bullets. It says ready to go, but when you attempt to shoot again, it wont fire. So unless I am missing a step between !reload and !shoot nick, all that comes up is click.

Also note that you will need to change channelname to either just # or a actual channel name, which I at first didn't notice as I just copied and pasted.

#109237 28/01/05 09:24 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
I tested it out as I thought it would be a interesting game. Noticed two error, from as far as I got into the game.

1) the nukem bit wont show the $me! part beacause of the !. Change it to $me $+ ! to make it work.


I finally got around to testing it, there are a few errors of that type thing, some messages dont say the $nick becuase there is a comma following it, as you say $identifier $+ character fixes that.

Quote:
2) Can't reload bullets. It says ready to go, but when you attempt to shoot again, it wont fire. So unless I am missing a step between !reload and !shoot nick, all that comes up is click.

in the !reload event the following line needs fixing...
% $+ $nick $+ _ammo = 6
needs replacing with
set -u10000000 % $+ $nick $+ _ammo 6

Quote:
Also note that you will need to change channelname to either just # or a actual channel name, which I at first didn't notice as I just copied and pasted.


see (1*) of my notes

I have actually Added a few things that i considered logic bugs into it as well since and patched a few bugs (likely not all), now if u shoot ya self ya dont get experence, if you shoot the bot he kills ya for it, The is $2 reviving test code was faulty its ment to check if $2 has a reviving flag not yourself $nick, also added the deaths and kills incrementors, they werent ever been set.

If you want ill post the code again, but i wont update it anymore since it wasnt mine to begin with. Asd the author deserves the right to guide its progress.

#109238 01/02/05 01:37 AM
Joined: Dec 2004
Posts: 18
S
sylain Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Dec 2004
Posts: 18
WOW! Thanks a lot! grin
you sir, made my day

#109239 01/02/05 02:00 AM
Joined: Dec 2004
Posts: 18
S
sylain Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Dec 2004
Posts: 18
ok, now that I have the base script... how do I make the script to use an anti-flood thing so it will only recognize a player's command ten seconds after their last action?
so, they shoot once, then no matter how many times they type "!shoot someone" it won't do anything until like, 5 seconds later? because with this script, it logged it, and executed our commands like, 5 seconds after we entered them ^^;

also, is there a way to make it so you must wait 20 seconds after dying to respawn?


Link Copied to Clipboard