mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2013
Posts: 61
E
Babel fish
OP Offline
Babel fish
E
Joined: Sep 2013
Posts: 61
Hi Everyone

Yes I'm new here, but thought this was the best place than any to post this.

I am currently trying to code a custom bot for Twitch, however, after using a pre-made bot, fancied a change.

Now, what I am after is simple in explanation, what I want is a command, that goes along the lines of:

User Types: !throw <user>
i.e. !throw EggFriedCheese.

Output: Bot: /me Throws a WhatAYolk At <user>
i.e. Bot Throws a WhatAYolk at EggFriedCheese

Now, the command first bit is fine, what I am having trouble with is setting that variable so that when the user types !throw <user>, it displays the user in the output.


I hope you guys can help me! smile

Eggy

Last edited by EggFriedCheese; 17/09/13 02:34 AM.

Twitch Live-Streamer:
Synth Riders
Beat Saber
www.twitch.tv/eggfriedcheese
Joined: Aug 2006
Posts: 183
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2006
Posts: 183
You can use $nick to grab the nickname of the person using the command. The command would be something like:

Code:
describe #chan throws an egg at $nick


If that doesn't help, post the portion of the script that you're having issues with.


Yar
Joined: Sep 2013
Posts: 61
E
Babel fish
OP Offline
Babel fish
E
Joined: Sep 2013
Posts: 61
Hey Thrull,

I don't think you completely understand what I'm trying to do here.

I don't need it to reply with the user that issued the command. I need it to play back the variable entered here:
throw <variable>

So the user types "!throw Thrull"

It would Return:

EggBotV1 Throws A WhatAYolk At Thrull.


Twitch Live-Streamer:
Synth Riders
Beat Saber
www.twitch.tv/eggfriedcheese
Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
you can try with:
Code:
on *:text:*:#: {
 echo -at $nick $1 $2
}

$nick return EggBotV1
$1 return !throw
$2 return Thrull

If you want to see the whole line, then use $1-

Replace the * with what you want it to react on.
on *:text:!throw *:#:

or you can make it so it triggers on more then one.
Code:
on *:text:*:#: {
 if ($1 == !throw) { echo -at throw }
 elseif ($1 == !meep) { echo -at meep }
 elseif ($1 == !moo) { echo -at moo }
}



if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Sep 2013
Posts: 61
E
Babel fish
OP Offline
Babel fish
E
Joined: Sep 2013
Posts: 61
I feel silly,

I can't seem to get this working.

This is what I have at the moment, the syntax is probably completely wrong, as I don't really have a clue what I am doing lol.

-------------
on *:TEXT:!throw %2:#: {
echo -at $1 $2
.msg # /me Throws a WhatAYolk at $2
}
-------------

If you can understand what I've done, I commend you.


I can kind of understand where Sparta has come from, but I don't know how to input it, as I just want it to repeat the entered variable in the output

So take for example:

User Types: !throw <m>
Output: /me Throws a WhatAYolk at <m>

If that makes it easier, or if someone can write it for me, I'd appreciate it lol.

Eggy


Twitch Live-Streamer:
Synth Riders
Beat Saber
www.twitch.tv/eggfriedcheese
Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
%2 will not return anything since you didnt set your variable anywhere in what you show me here, you can go at it like this if i unserstand you right
Code:
[on *:TEXT:!throw *:#: {
 if ($2 == WHAT YOU WANT IT TO BE) {
  echo -at $1 $2
  .msg # /me Throws a WhatAYolk at $2
 }
}

This will make a match with $2, so if you only want it to react on cow, then you enter ($2 == cow) . Or you can use a %variable there, ($2 == %variable) . then use /set %variable cow . You can name the %variable to what you want so long as it starts with the % sign, but make shure it also match when you set the %variable ..


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Sep 2013
Posts: 61
E
Babel fish
OP Offline
Babel fish
E
Joined: Sep 2013
Posts: 61
I don't really know the best way to explain this, that isn't really what I want it to do.


Okay, Let's say you wanted a command, to react, to what the user puts into the !text command. This isn't a fixed variable, it can change.

So the command needs to be written, so it pulls the information entered while the command is typed into the chat.



The Command is: !Throw <Manually Entered Word>
And The Output Would Be: /me Throws a WhatAYolk at <Manually Entered Word>.

The list of variables is not fixed, I just want to return whatever word is entered after the !Throw command.


For Example, Let's say I wanted to type -/- !Throw Giraffe
It would Return -/- /me Throws a WhatAYolk at Giraffe

Is there a way this can be done, as there is a feature as part of Nightbot that actually pulls the information from the command as a $touser variable.


Twitch Live-Streamer:
Synth Riders
Beat Saber
www.twitch.tv/eggfriedcheese
Joined: Feb 2006
Posts: 181
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2006
Posts: 181
Simple:
Code:
on *:TEXT:!throw *:#: describe # throws a WhatAYolk at $$2


With 3 seconds delay:

Code:
on *:TEXT:!throw *:#: {
  if (!$var($+(%,delay.throws.,$network,.,#)).value) {
    describe # throws a WhatAYolk at $$2
    set -u3 $+(%,delay.throws.,$network,.,#) 1
    ;If you specify the -uN switch, %var is unset after N seconds
  }
}

/help on text
/help /set
/help /describe
/help $var

Joined: Sep 2013
Posts: 61
E
Babel fish
OP Offline
Babel fish
E
Joined: Sep 2013
Posts: 61
Oh my GOD!

I LOVE YOU CRINUL! I've been giving myself a headache over this :P


Twitch Live-Streamer:
Synth Riders
Beat Saber
www.twitch.tv/eggfriedcheese

Link Copied to Clipboard