mIRC Homepage
Posted By: DJJIGGLER Cookie/Taco Script - 14/04/11 07:40 PM
Can anyone make me a script for, but i dont want it to be just these examples, i want to be able to add different actions like!

<Jiggler> !taco roman
* @Bot launches a delicious taco toward roman.
<Jiggler> !taco roman
* @Bot Gives roman a delicious taco.

and for when the !taco me:
<Jiggler> !taco Bot
* @Bot launches a taco straight up then jumps after it and catches it.
<Jiggler> !taco Bot
* @Bot Eats some tacos
Posted By: Riamus2 Re: Cookie/Taco Script - 14/04/11 08:09 PM
I made a very detailed script that allows for some really interesting control of that kind of thing and allows for easily adding a wide variety of types of commands and responses. However, it's not entirely ready for public use so I can't give it out at this time.

However, for a very basic setup, that is easy to edit, just do this:

Code:
on *:text:!*:#yourchannel: {
  if ($readini(mycommands.ini,$1)) {
    describe $chan $replace($readini(mycommands.ini,n,$1,$rand(1,$ini(mycommands.ini,$1,0))),#2#,$2)
  }
}


Then, create a file called mycommands.ini and format it like this:

Quote:

[!taco]
1=launches a delicious taco toward #2#
2=gives #2# a delicious taco
[!othercommand]
1=something
2=something else


#2# in the ini refers to word #2. In your example, that is the person's nick. If you need additional words, the $replace() can be updated to change #3# to $3, etc.

This isn't as configurable as is possible, but it's quickly set up and easy to change.

Replace #yourchannel with your channel name. And if you need commands that don't start with !, then remove that from the on text event and just use * instead of !*.
Posted By: DJJIGGLER Re: Cookie/Taco Script - 14/04/11 08:42 PM
Originally Posted By: Riamus2
I made a very detailed script that allows for some really interesting control of that kind of thing and allows for easily adding a wide variety of types of commands and responses. However, it's not entirely ready for public use so I can't give it out at this time.

However, for a very basic setup, that is easy to edit, just do this:

Code:
on *:text:!*:#yourchannel: {
  if ($readini(mycommands.ini,$1)) {
    describe $chan $replace($readini(mycommands.ini,n,$1,$rand(1,$ini(mycommands.ini,$1,0))),#2#,$2)
  }
}


Then, create a file called mycommands.ini and format it like this:

Quote:

[!taco]
1=launches a delicious taco toward #2#
2=gives #2# a delicious taco
[!othercommand]
1=something
2=something else


#2# in the ini refers to word #2. In your example, that is the person's nick. If you need additional words, the $replace() can be updated to change #3# to $3, etc.

This isn't as configurable as is possible, but it's quickly set up and easy to change.

Replace #yourchannel with your channel name. And if you need commands that don't start with !, then remove that from the on text event and just use * instead of !*.



I could not get that to work, i must of been setting it up wrong frown


Got this error

* Invalid parameters: $readini (line 2, Taco.ini)

I put: on *:text:!*:#yourchannel: { part into taco.ini

then i did the other part in mycommands

I did change #yourchannel to the channel btw
Posted By: RusselB Re: Cookie/Taco Script - 14/04/11 10:36 PM
You put the wrong information into the INI file.
Take a better look at the quote, not the code, used for examples as to how the INI file should be setup.
Simply, it appears that you tried to put the script into the INI file, rather than the responses.

Posted By: Riamus2 Re: Cookie/Taco Script - 15/04/11 12:18 AM
My fault...

Code:
on *:text:!*:#yourchannel: {
  if ($ini(mycommands.ini,$1)) {
    describe $chan $replace($readini(mycommands.ini,n,$1,$rand(1,$ini(mycommands.ini,$1,0))),#2#,$2)
  }
}


And you can rename mycommands.ini to something more appropriate if you like. Just make sure to replace the filename in all locations of the script.
Posted By: Tomao Re: Cookie/Taco Script - 15/04/11 12:34 AM
Originally Posted By: Riamus2
you can rename mycommands.ini to something more appropriate if you like. Just make sure to replace the filename in all locations of the script.
Why not make a local var for the file name so you only need to change it in one place?
Code:
on *:text:!*:#yourchannel: {
  var %file = mycommands.ini
  if ($ini(%file,$1)) {
    describe $chan $replace($readini(%file,n,$1,$rand(1,$ini(%file,$1,0))),#2#,$2)
  }
}
Posted By: Riamus2 Re: Cookie/Taco Script - 15/04/11 01:46 AM
Because I didn't bother and it isn't like you're changing it after the first time you type it.
Posted By: DJJIGGLER Re: Cookie/Taco Script - 15/04/11 03:50 AM
I got it working,

but how do i make when they !taco me

it does not say something like /me gives me a taco

when they do !taco me it says /me eats some tacos

get what im saying?
Posted By: Riamus2 Re: Cookie/Taco Script - 15/04/11 10:15 AM
Code:
on *:text:!*:#yourchannel: {
  if ($2 == $me && $ini(mycommands.ini,me,$1)) {
    describe $chan $replace($readini(mycommands.ini,n,me,$1),#2#,$2)
  }
  elseif ($ini(mycommands.ini,$1)) {
    describe $chan $replace($readini(mycommands.ini,n,$1,$rand(1,$ini(mycommands.ini,$1,0))),#2#,$2)
  }
}


Then, include a new section in your mycommands.ini file:

Quote:

[me]
!taco=eats some tacos
!something=does something else
!anothercommand=does another command


This does split the ini file up some, but it's a quick and easy thing to change. Note that it's not set up to do more than one $me response per command, unlike the random responses for the command when the nick isn't yours.
Posted By: Tomao Re: Cookie/Taco Script - 15/04/11 07:07 PM
So this will work with numbers as a cmd then? Remember we have had a scenario where numbers are confusing to $ini()...:P
Posted By: RusselB Re: Cookie/Taco Script - 15/04/11 10:45 PM
The numbers are confusing to $ini when they are used in reference to section and/or items.

As long as the command isn't just a number, they should work fine.

Eg: !1 will work
1 (probably) won't.
Posted By: Riamus2 Re: Cookie/Taco Script - 16/04/11 01:44 AM
If left unchanged, numbers won't even trigger the script because "commands" start with an exclamation point. If someone wants to change the script to do other things, then there may be certain changes that will need to be made. But as it is currently written, numbers are not an issue.
Posted By: Tomao Re: Cookie/Taco Script - 16/04/11 03:12 AM
Oh ok, just what I've thought. Thanks fellas for reaffirming the answer to my question.
© mIRC Discussion Forums