UPDATED
Simple script:
Commands
S9 what is
S9 where is
S9 can
S9 what color
The menu Includes:
A dialog for all round commands
A menu for each category to: Add, Look up or remove
REMEMBER TO ADD SOME STUFF BEFORE YOU TEST IT OUT
#qq on
on *:TEXT:*:#:{
if $1-3 == S9 where is {
:again
if $readini(Reply.ini, whereis, $rand(1,99)) { msg $chan $2- : $ifmatch }
else { goto again } }
if $1-2 == S9 can {
:again1
if $readini(Reply.ini, can, $rand(1,99)) { msg $chan $2- : $ifmatch }
else { goto again1 } }
if $1-3 == S9 what color {
:again2
if $readini(Reply.ini, color, $rand(1,99)) { msg $chan $2- : $ifmatch }
else { goto again2 } }
if $1-3 == S9 what is {
:again3
if $readini(Reply.ini, whatis, $rand(1,99)) { msg $chan $2- : $ifmatch }
else { goto again3 } }
}
alias -l theloop {
if $1-3 == S9 where is {
:again
if !$readini(Reply.ini, whereis, $rand(1,99)) { goto again }
else { return $ifmatch } }
if $1-2 == S9 can { msg $chan $readini(Reply.ini, can, $rand(1,99)) }
if $1-3 == S9 what color { msg $chan $readini(Reply.ini, color, $rand(1,99)) }
if $1-3 == S9 what is { msg $chan $readini(Reply.ini, whatis, $rand(1,99)) }
}
#qq end
#pp off
on *:TEXT:S9 where is*:#:/notice $nick $read(where.txt)
on *:TEXT:S9 can*:#:/notice $nick $read(Can.txt)
on *:TEXT:S9 what colour*:#:/notice $nick $read(colour.txt)
on *:TEXT:S9 what is*:#:/notice $nick $read(what.txt)
on *:TEXT:S9 *:#:/notice $nick $read(can.txt)
#pp end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
on 6:TEXT:S9off:*:{
enable #pp
disable #qq
notice $chan S9 will now reply via notice and can be used by soldiers now
}
on *:TEXT:S9 *:#:{
if ($group(#pp) = off) && ($group(#qq) = off) { /notice $nick Sorry S9 is not on }
else { halt }
}
on 6:TEXT:S9on:*:{
enable #qq
disable #pp
notice $chan MEssage is now on
}
on 6:TEXT:S9end:*:{
disable #qq
disable #pp
notice $chan S9 is now off
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
menu channel {
S9 commands
.The Dialog:/dialog -dm test test
.Where is
..Write where is:$whereis
..Look up:/$ewhereis
..Remove line:/$rwhereis
.Can I
..Write Can I:/$can
..Look up:$ecan
..Remove line:/$rcan
.What color
..Write what color:/$whatc
..Look up:$ewhatc
..Remove line:/$rwhatc
.What is
..Write what is:/$whati
..Look up:$ewhati
..Remove line:/$rwhati
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
alias can {
echo $?=" Enter the new word that you would like to show when said "
if !$! { halt }
else {
set %x $calc($lines(reply.ini) + 1)
set %word $!
set %b 1
:loop
if %b == %x {
writeini reply.ini can %b %word
echo Written }
else {
if $readini(reply.ini, can , %b) {
inc %b
goto loop
}
else {
writeini reply.ini can %b %word
echo Written }
}
}
}
alias whatc {
echo $?=" Enter the new word that you would like to show when said "
if !$! { halt }
else {
set %x $calc($lines(reply.ini) + 1)
set %word $!
set %b 1
:loop
if %b == %x {
writeini reply.ini color %b %word
echo Written }
else {
if $readini(reply.ini, color, %b) {
inc %b
goto loop
}
else {
writeini reply.ini color %b %word
echo Written }
}
}
}
alias whati {
echo $?=" Enter the new word that you would like to show when said "
if !$! { halt }
else {
set %x $calc($lines(reply.ini) + 1)
set %word $!
set %b 1
:loop
if %b == %x {
writeini reply.ini whatis %b %word
echo Written }
else {
if $readini(reply.ini, whatis, %b) {
inc %b
goto loop
}
else {
writeini reply.ini whatis %b %word
echo Written }
}
}
}
alias whereis {
echo $?=" Enter the new word that you would like to show when said "
if !$! { halt }
else {
set %x $calc($lines(reply.ini) + 1)
set %word $!
set %b 1
:loop
if %b == %x {
writeini reply.ini whereis %b %word
echo Written }
else {
if $readini(reply.ini, whereis, %b) {
inc %b
goto loop
}
else {
writeini reply.ini whereis %b %word
echo Written }
}
}
}
;;;;;;;;;;;;;;;;;;;;
alias ewhereis {
$?="Enter The number for the Sentance"
if $readini(reply.ini, whereis, $!) { echo $! : $ifmatch }
else { echo No record for that number is saved }
}
alias ewhati {
$?="Enter The number for the Sentance"
if $readini(reply.ini, whatis, $!) { echo Line $! : $ifmatch }
else { echo No record for that number is saved }
}
alias ecan {
$?="Enter The number for the Sentance"
if $readini(reply.ini, can, $!) { echo $! : $ifmatch }
else { echo No record for that number is saved }
}
alias ewhatc {
$?="Enter The number for the Sentance"
if $readini(reply.ini, color, $!) { echo $! : $ifmatch }
else { echo No record for that number is saved }
}
;;;;;;;;;;;;;;;;;;;;
alias rwhati {
$?="Enter The number for the Sentance to remove"
if $readini(reply.ini, whatis, $!) {
echo $! removed : $ifmatch
remini reply.ini whatis $!
}
else { echo No record for that number is saved }
}
alias rwhereis {
$?="Enter The number for the Sentance"
if $readini(reply.ini, whereis, $!) {
echo $! : $ifmatch
remini reply.ini whereis $!
}
else { echo No record for that number is saved }
}
alias ecan {
$?="Enter The number for the Sentance"
if $readini(reply.ini, can, $!) {
echo $! : $ifmatch
remini reply.ini can $!
}
else { echo No record for that number is saved }
}
alias ewhatc {
$?="Enter The number for the Sentance"
if $readini(reply.ini, color, $!) {
echo $! : $ifmatch
remini reply.ini color $!
}
else { echo No record for that number is saved }
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
dialog test {
title Script Questions
size -1 -1 110 100
option dbu
tab "Where", 1, 5 5 100 90
tab "What", 2
tab "Color", 3
tab "Can", 4
button "Add Where", 11, 30 25 50 12, ok tab 1
button "Look up", 18, 30 50 50 12, ok tab 1
button "Remove", 20, 30 75 50 12, ok tab 1
button "Add what", 12, 30 25 50 12, tab 2
button "look up", 17, 30 50 50 12, tab 2
button "Remove", 21, 30 75 50 12, ok tab 2
button "Add color", 13, 30 25 50 12, tab 3
button "look up", 16, 30 50 50 12, tab 3
button "Remove", 22, 30 75 50 12, ok tab 3
button "Add can", 14, 30 25 50 12, tab 4
button "Look up", 15, 30 50 50 12, tab 4
button "Remove", 23, 30 75 50 12, ok tab 4
}
on 1:dialog:TEST:sclick:20: {
$rwhereis
}
on 1:dialog:TEST:sclick:21: {
$rwhati
}
on 1:dialog:TEST:sclick:22: {
$rwhatc
}
on 1:dialog:TEST:sclick:23: {
$rcan
}
on 1:dialog:TEST:sclick:11: {
$whereis
}
on 1:dialog:TEST:sclick:12: {
$whati
}
on 1:dialog:TEST:sclick:13: {
$whatc
}
on 1:dialog:TEST:sclick:14: {
$can
}
on 1:dialog:TEST:sclick:15: {
$ecan
}
on 1:dialog:TEST:sclick:16: {
$ewhatc
}
on 1:dialog:TEST:sclick:17: {
$ewhati
}
on 1:dialog:TEST:sclick:18: {
$ewhere
}
lol wtf, 26 comments i stopped reading after a while because it just became an argument, and my script is just sitting in the background crying at your insults.
And yes i would of probably used ini files, but at the time of making the script, i was crap with ini's (in someways still am) but as this script does the job ok, and all it needs doing is your own personal touch, that you have posted anyways :p.
i hope i don't start an argument between you lot about hask and ini's etc that will go on through about 10 more snippets, all i did is make an 8 ball sniipet :s
ahh for frig tarts sake :| somone just remake the code for him, and tbh inis are better that hash tables for long term storage, i dont want to hload the hash table everytime i start and inis are not bad for small things but tbh a variable would be better since its only 1 thing and your only using 4 :|, and tbh setting a variable -e is as good as using hash tables.
lmao...... most people that act alike hash is more work dont really understand them so just agree an move on it's just another magic 8 ball script ffs.
old version i made long ago
ask in the form of a question
on $*:text:/^(8ball\s(.+)\?)$/S:#:{ if (!$($+(%,ball8flood),2)) { set -u3 $+(%,ball8flood) $nick | if ($sock(8ball)) .sockclose 8ball | sockopen 8ball pages.cs.wisc.edu 80 | .sockmark 8ball # } }
on *:SOCKOPEN:8ball: { sockwrite -nt $sockname GET /~craft/8ball.cgi HTTP/1.1 | sockwrite -nt $sockname Host: $+(pages.cs.wisc.edu,$str($crlf,2)) }
on *:SOCKREAD:8ball: {
var %8ball | sockread %8ball
if ($regex(%8ball,/<h4>(.+)<\/h4>/)) { msg $sock(8ball).mark 14[04The magic 8ball says:14] $regml(1) | sockclose 8ball }
}
on *:LOAD:{
write where.txt IN A BIN
write can.txt No you can't
write color.txt RED!
write what.txt A balloon
write where.txt IN A HOUSE
write can.txt maybe..
write color.txt RED!
write what.txt A Dragon with not one not two but 3 heads!
write can.txt SAY PLEASE
}
Does no one care to use ini files anymore? This would be a great time to start. One ini looks better then 4 txt files.
[8ball]
where=IN A BIN,IN A HOUSE
can=No you can't,maybe..,SAY PLEASE
color=RED!,BLUE!
what=A balloon,A Dragon with not one not two but 3 heads!
Throw in a $readini, $r, $numtok and $gettok and your set.
lol i aint very good at scokects been meaning to get around to learning how to use em just have not yet also this script was actually smaller and simpler because i used it but when i uploaded it i though i would put more detail in to it aka the menu ect but i was looking through all the 8balls and they are all mainly the same ect that dialog one that was good but other then that they were the same just with different names %var ect lol
the /'s arent needed but im glad to see that its different from all other of the 30-40 some 8ball scripts on here
another approach could be using a socket to get many more possibilities
alias 8ball {
sockopen 8ball web.ics.purdue.edu 80
sockmark 8ball $replace($1-,$chr(32),_)
}
on *:sockopen:8ball: {
sockwrite -n $sockname GET $+(/~ssanty/cgi-bin/eightball.cgi?question=,$sock($sockname).mark) HTTP/1.1
sockwrite -n $sockname HOST: web.ics.purdue.edu $+ $crlf $+ $crlf
}
on *:sockread:8ball: {
var %a | sockread %a
if ($regex(%a,/<center><h1>Magic Eight Ball</h1> <hr /> <img src="/~ssanty/images/\d.gif" alt="(.*?)" /> <hr /> Question:/i)) {
echo -a $replace($sock($sockname).mark,_,$chr(32)) $+ : $regml(1)
}
}
that site doesnt have that many responses but its just an example
on *:TEXT:!8 where is*:#:/notice $nick $read(where.txt)
on *:TEXT:!8 can*:#:/notice $nick $read(Can.txt)
on *:TEXT:!8 what color*:#:/notice $nick $read(color.txt)
on *:TEXT:!8 what is*:#:/notice $nick $read(what.txt)
on *:TEXT:!8 *:#:/notice $nick $read(can.txt)
Could all be put in 1 on text event :p.
Btw, you should put an on load and not have us have to put it in ourselves :(!
Line 34
notice chan 8 ill reply via msg now
Should be Notice $Chan.
However, that's even worse than /Msg $Chan as everyone gets beeped, so you should do notice $Nick.
You can also delete a bracket from line 75-78 because you forgot the space after { /Halt} so that'd cut down a line if you remove that line + add a space.