|
Joined: Dec 2011
Posts: 3
Self-satisified door
|
OP
Self-satisified door
Joined: Dec 2011
Posts: 3 |
Hello guys, this is my first time here so i may post this in wrong section.
I need some help with scripting. This is what i need, when a HalfOP+ enter's a command like this:
!dd (user name 1) (user name 2) 5m
as example:
!dd Gangster1 Master2 5m
than the bot has to say:
Dyce duel Between Gangster1 and Master2 has begun. Roll now.
and after they have to do !roll (already had the script.)
and than like gangster rolled a 4 and master a 2 than the bot has to say the results from both. like
gangster won the 5m pot with a 4-2
if people dont understand this than im albe to teamview what i mean.
GambleBills
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
All scripting questions should be in the scripting forum.
on *:text:!dd *:#yourchannel: {
; You can remove the first two IF lines if you don't care about checking if the nicks are on the channel.
if ($2 !ison $chan) { msg $chan $2 is not a valid nick. | halt }
if ($3 !ison $chan) { msg $chan $3 is not a valid nick. | halt }
if (!$4) { msg $chan Invalid format. Use: !dd nick1 nick2 reward | halt }
set %dd $2 $3 $4
msg $chan Dice duel between $2 and $3 has begun.
}
on *:text:!roll:#yourchannel: {
if (!%dd) { msg $chan No duel in progress. | halt }
var %r1 = $rand(1,6), %r2 = $rand(1,6), %d1 = $gettok(%dd,1,32), %d2 = $gettok(%dd,2,32), %p = $gettok(%dd,3,32)
msg $chan %d1 rolled a %r1 $+ .
msg $chan %d2 rolled a %r2 $+ .
if (%r1 > %r2) { msg $chan %d1 won the %p pot with a %r1 $+ - $+ %r2 $+ . }
elseif (%r2 > %r1) { msg $chan %d2 won the %p pot with a %r1 $+ - $+ %r2 $+ . }
else { msg $chan %d1 and %d2 tied with a %r1 $+ - $+ %r2 $+ . }
unset %dd
}
That's a basic script for you. I could have set more than one global variable in the !dd section instead of using one global and then a lot of local variables in the !roll section, but I prefer avoiding global variables unless needed. I didn't add any flood protection. You can add any generic flood protection you like or just mIRC's flood protection if you think there is a need.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Dec 2011
Posts: 3
Self-satisified door
|
OP
Self-satisified door
Joined: Dec 2011
Posts: 3 |
All scripting questions should be in the scripting forum.
on *:text:!dd *:#yourchannel: {
; You can remove the first two IF lines if you don't care about checking if the nicks are on the channel.
if ($2 !ison $chan) { msg $chan $2 is not a valid nick. | halt }
if ($3 !ison $chan) { msg $chan $3 is not a valid nick. | halt }
if (!$4) { msg $chan Invalid format. Use: !dd nick1 nick2 reward | halt }
set %dd $2 $3 $4
msg $chan Dice duel between $2 and $3 has begun.
}
on *:text:!roll:#yourchannel: {
if (!%dd) { msg $chan No duel in progress. | halt }
var %r1 = $rand(1,6), %r2 = $rand(1,6), %d1 = $gettok(%dd,1,32), %d2 = $gettok(%dd,2,32), %p = $gettok(%dd,3,32)
msg $chan %d1 rolled a %r1 $+ .
msg $chan %d2 rolled a %r2 $+ .
if (%r1 > %r2) { msg $chan %d1 won the %p pot with a %r1 $+ - $+ %r2 $+ . }
elseif (%r2 > %r1) { msg $chan %d2 won the %p pot with a %r1 $+ - $+ %r2 $+ . }
else { msg $chan %d1 and %d2 tied with a %r1 $+ - $+ %r2 $+ . }
unset %dd
}
That's a basic script for you. I could have set more than one global variable in the !dd section instead of using one global and then a lot of local variables in the !roll section, but I prefer avoiding global variables unless needed. I didn't add any flood protection. You can add any generic flood protection you like or just mIRC's flood protection if you think there is a need. Tysm, but i mean they need to roll at their own, like u vs me, so i have to roll and you have to roll. and at the scores when its about who won, it shows just who is noticed first, like i won a 4-6 it should show 6-4 i would really appriciate if you could help me more.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
on *:text:!dd *:#yourchannel: {
; You can remove the first two IF lines if you don't care about checking if the nicks are on the channel.
if ($2 !ison $chan) { msg $chan $2 is not a valid nick. | halt }
if ($3 !ison $chan) { msg $chan $3 is not a valid nick. | halt }
if (!$4) { msg $chan Invalid format. Use: !dd nick1 nick2 reward | halt }
set %dd $2 $3 $4
msg $chan Dice duel between $2 and $3 has begun.
.timerDD 1 300 EndDD
}
on *:text:!roll:#yourchannel: {
if (!%dd) { msg $chan No duel in progress. | halt }
if (!$istok(%dd,$nick,32)) { msg $chan You are not one of the duelists. | halt }
if ($($+(%,ddr.,$nick),2)) { msg $chan You have already rolled. | halt }
var %r = $rand(1,6), %d1 = $gettok(%dd,1,32), %d2 = $gettok(%dd,2,32), %p = $gettok(%dd,3,32)
set %ddr. $+ $nick %r
msg $chan $nick rolled a %r $+ .
var %r1 = $($+(%,ddr.,$gettok(%dd,1,32)),2), %r2 = $($+(%,ddr.,$gettok(%dd,2,32)),2)
if (%r1 && %r2) {
if (%r1 > %r2) { msg $chan %d1 won the %p pot with a %r1 $+ - $+ %r2 $+ . }
elseif (%r2 > %r1) { msg $chan %d2 won the %p pot with a %r2 $+ - $+ %r1 $+ . }
else { msg $chan %d1 and %d2 tied with a %r1 $+ - $+ %r2 $+ . }
unset %dd
unset %ddr.*
.timerDD off
}
}
alias EndDD {
msg $chan The duel ran out of time and has been ended.
unset %dd
unset %ddr.*
}
Ok, this should do what you asked. It will also automatically end the duel after 5 minutes (300 seconds) in case one person never rolls. If you want to adjust that time, change the 300 in the timer to something else.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Dec 2011
Posts: 3
Self-satisified door
|
OP
Self-satisified door
Joined: Dec 2011
Posts: 3 |
on *:text:!dd *:#yourchannel: {
; You can remove the first two IF lines if you don't care about checking if the nicks are on the channel.
if ($2 !ison $chan) { msg $chan $2 is not a valid nick. | halt }
if ($3 !ison $chan) { msg $chan $3 is not a valid nick. | halt }
if (!$4) { msg $chan Invalid format. Use: !dd nick1 nick2 reward | halt }
set %dd $2 $3 $4
msg $chan Dice duel between $2 and $3 has begun.
.timerDD 1 300 EndDD
}
on *:text:!roll:#yourchannel: {
if (!%dd) { msg $chan No duel in progress. | halt }
if (!$istok(%dd,$nick,32)) { msg $chan You are not one of the duelists. | halt }
if ($($+(%,ddr.,$nick),2)) { msg $chan You have already rolled. | halt }
var %r = $rand(1,6), %d1 = $gettok(%dd,1,32), %d2 = $gettok(%dd,2,32), %p = $gettok(%dd,3,32)
set %ddr. $+ $nick %r
msg $chan $nick rolled a %r $+ .
var %r1 = $($+(%,ddr.,$gettok(%dd,1,32)),2), %r2 = $($+(%,ddr.,$gettok(%dd,2,32)),2)
if (%r1 && %r2) {
if (%r1 > %r2) { msg $chan %d1 won the %p pot with a %r1 $+ - $+ %r2 $+ . }
elseif (%r2 > %r1) { msg $chan %d2 won the %p pot with a %r2 $+ - $+ %r1 $+ . }
else { msg $chan %d1 and %d2 tied with a %r1 $+ - $+ %r2 $+ . }
unset %dd
unset %ddr.*
.timerDD off
}
}
alias EndDD {
msg $chan The duel ran out of time and has been ended.
unset %dd
unset %ddr.*
}
Ok, this should do what you asked. It will also automatically end the duel after 5 minutes (300 seconds) in case one person never rolls. If you want to adjust that time, change the 300 in the timer to something else. what will happen when they tie? can you do it so they have to re roll? and can you make it avaible for multiple duels? and Halfop+? i might pay you for this if you want. i really need this.
Last edited by gamblebills; 09/12/11 04:17 PM.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
If they tie, it ends like any other time. They do !dd again if they want another duel or they can stop. If you want this only for halfops+, then just throw in an IF at the beginning of the !dd event where the other IFs are: if ($nick isvoice || $nick isreg) { msg $chan Only halfop or higher can start a duel. | halt }
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Jan 2012
Posts: 5
Nutrimatic drinks dispenser
|
Nutrimatic drinks dispenser
Joined: Jan 2012
Posts: 5 |
How do you make it re-roll and make it so only voiced members + can use the command !dd user1 user2 200m ?
|
|
|
|
Joined: Feb 2012
Posts: 9
Nutrimatic drinks dispenser
|
Nutrimatic drinks dispenser
Joined: Feb 2012
Posts: 9 |
since i want to start a dicing clan, i tried it. but every time i add someone to a dice duel and they roll it says that their is no duel in progress. am i typing in the wrong command or is their something else im forgetting. i just copied and pasted the script in. changed nothing else.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
You have 5 minutes after typing !dd nick nick reward to use !roll or the duel ends. As long as you type the right !dd command and you !roll in time, you shouldn't get that message. If you do, then your variable is being unset by something -- perhaps another script.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Feb 2012
Posts: 9
Nutrimatic drinks dispenser
|
Nutrimatic drinks dispenser
Joined: Feb 2012
Posts: 9 |
i just pasted it into the remote section in the scripts editor. is that all i need to do?
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Yes. As long as it's a blank script file, it should work fine. If you have other scripts, there's the possibility one is conflicting with it and removing the variable.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Feb 2012
Posts: 9
Nutrimatic drinks dispenser
|
Nutrimatic drinks dispenser
Joined: Feb 2012
Posts: 9 |
it wont work. ill type ex. !dd ham turky 1m and when they do !roll it says that their is no duel in progress
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Not really sure what to tell you. The variable that gives that message is set when doing %dd and not unset for 5 minutes. As long as it is set, it won't display that message. You'd have to do some troubleshooting to find out why the variable is being unset or not being set.
You *do* have the message saying the duel is started, right? If not, then the first part of the script isn't triggering for whatever reason. If that's the case, you have another script causing a problem or you're using colors when typing !dd or something like that.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
You dont try to type !dd your self? if so you need to use :input: instead of :text:
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Feb 2012
Posts: 9
Nutrimatic drinks dispenser
|
Nutrimatic drinks dispenser
Joined: Feb 2012
Posts: 9 |
i dont have the message that the duel is starting. what should i do troubleshoot? im not good with this scripting stuff and the variables i have are....
%dice_Port 6667 %dice_Channel #privvy %dice_useHotbits 0 %dice_useColors 1 %dice_prefix $player %dice_echoExpression 1 %dice_echoDescription 1 %dice_echoRolls 1 %dice_clrPrefix 4,1 %dice_clrExpression 7,1 %dice_clrDescription 4,1 %dice_clrRollList 10,1 %dice_clrTotal 8,1
which ones should i remove?
Last edited by johnnygold2; 14/02/12 11:22 PM.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
You don't remove any of those variables. But the fact that you have dice variables says you have some other dice script and it may interfere. Also, as sparta said, if you are running the script on the same client you're trying to type !dd from, then it won't work. It was written to act as a bot where the !dd command is done by someone else.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Feb 2012
Posts: 9
Nutrimatic drinks dispenser
|
Nutrimatic drinks dispenser
Joined: Feb 2012
Posts: 9 |
ok well i deleted the other dice script. now i dont get the message saying that theirs not dice duel in progress when someone types !roll but it wont roll and it still doesnt show that the duel has been started. i still have the variables and do i need to add any commands?
Last edited by johnnygold2; 15/02/12 09:02 PM.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
All I can suggest is to make sure the script is in a new file (not underneath any other script) and that you don't try triggering it yourself. Beyond that, you'd have to troubleshoot why it's not working because it should work fine.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Feb 2012
Posts: 9
Nutrimatic drinks dispenser
|
Nutrimatic drinks dispenser
Joined: Feb 2012
Posts: 9 |
what you mean by being in a new file?
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Alt-R > File > New and then paste. If you already have it as part of another script (same file), then delete it from there first. Then do File > New and paste. Any time someone gives you a script, you should place it in its own file and not put it in the same file as another script to avoid possible problems.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
|