mIRC Home    About    Download    Register    News    Help

Print Thread
#198749 04/05/08 04:19 AM
Joined: May 2008
Posts: 5
R
R4nk3d Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: May 2008
Posts: 5
http://www.paste.mircscripting.info/index.php?id=2764

Whats wrong with that? Why wont it work.

R4nk3d #198751 04/05/08 04:24 AM
Joined: May 2008
Posts: 329
A
Fjord artisan
Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
why not just use $nick ison $chan ?


I registered; you should too.
AWEstun #198754 04/05/08 04:48 AM
Joined: May 2008
Posts: 5
R
R4nk3d Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: May 2008
Posts: 5
Alright. Ill try that. Im not sure if itll work for what im trying.

R4nk3d #198756 04/05/08 05:07 AM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Are you sure %nick is being set to what you are expecting? Try adding this debug line:

/echo -s nick: %nick

Assuming the variable is being set correctly (ie to a nickname who is on the channel where the text is received), the code should work as it is written.

-genius_at_work

Joined: May 2008
Posts: 329
A
Fjord artisan
Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
echo is your best friend when scripting !!!


I registered; you should too.
Joined: May 2008
Posts: 5
R
R4nk3d Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: May 2008
Posts: 5
ok. thanks. ill try both when i can.

R4nk3d #198761 04/05/08 05:49 AM
Joined: May 2008
Posts: 127
J
Vogon poet
Offline
Vogon poet
J
Joined: May 2008
Posts: 127
R4nk3d is a scripting noob. :P

We run a gaming server. Basically everything that is said from inside the game is echoed into an IRC channel. The ingame players aren't actually in the channel - there's one bot that echos everything, e.g.:

Quote:

(01:43) · [KUMB] · Aaron_butche(1) - Hi!
(01:43) · [KUMB] · Scion(4) - Hello smile
(01:43) · [KUMB] · Joe_Dean(3) - Welcome!!


The %nick var is used to extract the actual name from the (*) (this is the players ID ingame). We don't want to include their ID's, so the %nick var gets everything until it hits the first occurrence of '(', then stops there.

Now, if %nick is also inside the IRC channel and not just ingame, I want the script to allow use of the script by this user.

-----------------------------------

So if a player ingame types !blah, the script must check to see if that name is also in the IRC channel (by using: if (%nick ison $chan) {

This isn't added into the script that R4nk3d linked, but the plan is to restrict the use of the script to voiced users. So:

Quote:
if (%nick ison $chan) && (%nick isvoice $chan) {


But that's just the next step of the script - I need to know first how to use vars in an IF statement.

Last edited by Joe_Dean; 04/05/08 06:06 AM.
R4nk3d #198763 04/05/08 06:01 AM
Joined: May 2008
Posts: 127
J
Vogon poet
Offline
Vogon poet
J
Joined: May 2008
Posts: 127
Here's a small script I made to autoban when a player ingame advertises an IP & Port. Perhaps it'll give you an idea of how I make the scripts interact with users inside the gaming server.

http://www.paste.mircscripting.info/index.php?id=2766

Basically does this:
Quote:

[KUMB] · Kim_Annabeth(1) - 12.34.56.78:1234
Naed · !say Advertising is prohibited on this server, Kim_Annabeth.
Naed · !ban Kim_Annabeth
[KUMB] · Naed(IRC) - Advertising is prohibited on this server, Kim_Annabeth.
[KUMB] · ***(ADMIN BAN)*** player Kim_Annabeth has been banned from the gaming server.


Basically, Kim_Annabeth advertises an IP ingame. Then, Naed (the IRC bot I'm scripting) warns the player then bans them.

!say is just a command to echo stuff from IRC into the game
!ban is an IRC command that OPs use to ban players ingame via IRC.

Where it says ***(ADMIN BAN)*** is what happens in the server; it shows the player being banned ingame.

Joe_Dean #198764 04/05/08 06:03 AM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Try this instead:

var %nick = $gettok($1,1,40)

By what you are describing, you will need to store the names of the users who are in both locations, and then use that to allow them access to the script commands.

-genius_at_work

Joined: May 2008
Posts: 127
J
Vogon poet
Offline
Vogon poet
J
Joined: May 2008
Posts: 127
That does nothing, -at all-.

I'm not the best with scripting either, I'm still in my learning stages. Could you explain what that does, exactly? The help file confuses me. :P

If this helps: the ID from the players name needs to be extracted from the actual name. If I were to just use $1 (look above, this is the playername followed by the ID (*) e.g. Kim_Annabeth(4), this would return the entire name & ID, Kim_Annabeth(4). And obviously that name isn't going to be in the IRC channel, however Kim_Annabeth would be.

I can't take away the IDs - it's a part of the gaming server, so the (*) MUST be extracted for this script to work.

Joe_Dean #198802 04/05/08 05:36 PM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
This:

var %nick = $gettok($1,1,40)

is a replacement for this:

var %nick $mid($1,1,$calc($pos($1,$chr(40),1) - 1))

nothing more.

-genius_at_work

Joined: May 2008
Posts: 127
J
Vogon poet
Offline
Vogon poet
J
Joined: May 2008
Posts: 127
Yeah, sorry, it didn't work before simply because I had a mistake in the script (not pertaining to the $gettok).

Anyways, this works, sorta. It doesn't work properly, and I can't figure out what is going on.

Quote:

[KUMB] · Joe_Dean(0) - !blahtest
&Naed · no
~Joe_Dean · !blahtest
&Naed · no
~Joe_Dean · !say !blahtest
&Naed · no
[KUMB] · Joe_Dean(IRC) !blahtest
&Naed · yes


So basically:

- If I'm inside the gaming server and I type "!blahtest", the bot says no (no meaning, not in the channel).
- If I'm in the IRC channel and type "!blahtest", the bot says no.
- HOWEVER, if I'm in the IRC channel and echo "!blahtest" into the gaming server, the bot says yes AND no.

I don't understand...

Joe_Dean #198825 05/05/08 01:31 AM
Joined: May 2008
Posts: 127
J
Vogon poet
Offline
Vogon poet
J
Joined: May 2008
Posts: 127
Ohh, could it be because when I say something inside the gaming server, my name has a number at the end (Joe_Dean(0)), but if I'm echoing into the gaming server via the IRC channel, my name has letters at the end (Joe_Dean(IRC)) ?

Joe_Dean #198952 07/05/08 03:49 AM
Joined: May 2008
Posts: 127
J
Vogon poet
Offline
Vogon poet
J
Joined: May 2008
Posts: 127
*bump*

Joe_Dean #199084 08/05/08 09:28 PM
Joined: May 2008
Posts: 127
J
Vogon poet
Offline
Vogon poet
J
Joined: May 2008
Posts: 127
*sigh*

*bump again*

Joe_Dean #199119 09/05/08 03:19 AM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
OK let's clarify what you want:

You want a mIRC script that will respond to a peice of text with the format "somenick(id) - !blahtest" and check if that user (minus the (id) portion) is on the current IRC channel?

Code:
on *:TEXT:& - !blahtest:#:{
  var %nick = $gettok($1, 1, 40)
  if (%nick ison $chan) {
      something here
  }
}


That should work. If it doesn't then either there's another script interfering or there's something else going on you haven't mentioned.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: May 2008
Posts: 127
J
Vogon poet
Offline
Vogon poet
J
Joined: May 2008
Posts: 127
Code:
on *:TEXT:& - !blahtest:#:{
  var %nick = $gettok($1, 1, 40)
  if (%nick ison $chan) {
      msg $chan !say In the IRC
  }
  else {
    msg $chan !say Not in IRC
  }
}


Quote:

[KUMB] · Joe_Dean(3) - !blahtest
&Naed · !say Not in IRC
[KUMB] · Naed(IRC) Not in IRC

Joe_Dean #199137 09/05/08 05:24 AM
Joined: May 2008
Posts: 127
J
Vogon poet
Offline
Vogon poet
J
Joined: May 2008
Posts: 127
http://www.lvrcr.com/ircscreen.png

The green text is me.

EDIT: Notice I am in the channel.

Last edited by Joe_Dean; 09/05/08 05:25 AM.
Joe_Dean #199138 09/05/08 05:29 AM
Joined: May 2008
Posts: 127
J
Vogon poet
Offline
Vogon poet
J
Joined: May 2008
Posts: 127
ROFL, I'm such a noob. XD

Code:
on *:TEXT:& - !blahtest:#:{
  var %nick = $gettok($1, 1, 40)
  if ($strip(%nick) ison $chan) {
      msg $chan !say In the IRC
  }
  else {
    msg $chan !say Not in IRC
  }
}


My name in the gaming server is in bold and my name on IRC isn't. :P


Link Copied to Clipboard