|
|
|
Anathema
|
|
Anathema
|
Ok, I don't think this question falls precisely inside the bounds of this forum, but it's the most appropriate for what I need.
I'm going out of my mind looking for this small, simple, piece of script. Just something that will record a users input, and then spit that input out each time that user joins the channel; this is an identical function to !setinfo seen on gamesnet and other networks. I've seen it in regular channel bots before, but I haven't been able to find a single script that has this function in it.
I do understand programming/scripting theory, and can muddle my way through code enough to understand a specific function, but I don't actually know mirc scripting enough to write it myself.
I'm not asking someone just pound this code out for me, but if anyone knows the direction to point me in at least .. ANYTHING .. would be a tremendous help. I'm exhasperated, espically after a week of searching and not having so much as a whiff of a script that supports this function.
I hope I'm not asking something outside the scope of this forum, and thanks in advance for any helpful responses.
|
|
|
|
|
|
theRat
|
|
theRat
|
/help on join to display the msg when some1 joins
/help on text to react to "!setinfo" command
/help hash tables or /help ini files or /help variables to save the data :tongue:
|
|
|
|
|
|
Anathema
|
|
Anathema
|
Ok, while not exactly the response I was looking for, letting me know that hash tables is what I needed was a big help. Though I do have a couple questions. The first is when you specify a user level (such as - on *:JOIN:#:), is there a way to specify a MINIMUM user level? Or is it automatic? For example, if I did - on 3:JOIN:#: - would it work for anyone with that level and above, or ONLY for that level? .. If so, is there a way to set said minimum user level? (I don't want unvoiced users using this function). That being said, my second question is basically asking for a review of the code:
on *:START:
{
hmake setinfo 10
;creates the hash file
if
{
($isfile(setinfo.htb)) hload setinfo setinfo.htb
;loads previous setinfo hash file
}
else
{
}
.timersave 0 300 hsave -o setinfo setinfo.htb
;saves the hash file at 5 minute increments
}
on *:EXIT:
{
hsave -o setinfo setinfo.htb
;saves the hash file on exit
}
on *:TEXT:!setinfo *:#:
{
if ($2 == $null)
{
.msg $nick Your setinfo is: [ $+ $gettok($hget(setinfo,$nick),1,32) $+ ]: $deltok($hget(setinfo,$nick),1,32)
;this is so someone can see what their setinfo is, in private message, for whatever reason.
}
elseif ($2 == "delete")
{
hdel $nick
;to allow someone to delete their setinfo
}
else
{
hadd setinfo $nick $2
;creates and (should) replace a users setinfo
}
}
on *:JOIN:#:
{
if ($nick == ($hmatch(setinfo,$nick)))
{
.msg # [ $+ $gettok($hget(setinfo,$nick),1,32) $+ ]: $deltok($hget(setinfo,$nick),1,32)
;displays the setinfo to the channel that the person joins
}
else
{
}I hope it's not totally out of whack, this is my first swing at mIRC scripting.  Edit: I forgot the comments
Last edited by Anathema; 23/05/03 07:55 PM.
|
|
|
|
|
Joined: Jan 2003
Posts: 2,973
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,973 |
Well, to answer the first question, yes if you had
on 3:JOIN:#: { }
Levels 3 and above can access that command. To make it a fixed level, use the = prefix of the level. e.g.
on =3:JOIN:#: { }
For more help on that, type /help levels
--
As for your code, how it works with the { 's on a new line I'll never know, but it looks good. Maybe you did it for legibility? Also, similar to pheonix, the else {}'s are uneeded. Unless it helps you for recognizing what is going on, you can remove them.
|
|
|
|
|
|
Anathema
|
|
Anathema
|
As for your code, how it works with the { 's on a new line I'll never know, but it looks good. Maybe you did it for legibility? Also, similar to pheonix, the else {}'s are uneeded. Unless it helps you for recognizing what is going on, you can remove them.
Yes, the extra spacing is indeed for legibility, but I never said it worked :tongue: .. at this point it doesn't, which leads me to believe that I need to take the spaces out to begin with. What are the typical spacing rules for mIRC scripting? And, when you say the "else {}'s are not needed" does that mean the entire phrase isn't needed (meaning a blank 'else' phrase is assumed), or just the brackets? Thanks to you both
|
|
|
|
|
Joined: Jan 2003
Posts: 2,973
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,973 |
well, unlike compilers like of c\c++, or even web-based php, mirc doesn't like new lines with the open braces. The syntax usually isas follows:
if (condition) { } else if (condition) { } | else { }
I showed you two versions of the carry over lines. The first shows, you can have statements on a new line, just the { must alwas precede the condition. The second shows how you are allowed to do a carry over, and if you have another statement in that group, you must use a pipe ( | ) before it. the third shows the statement may be on the same line.
As for the else's i was jsut stating that the complete else { } is not neccisary. ex:
if (condition) { .statements. } else { }
can be
if (condition) { .statements. } EDIT: Spelling (Some)
|
|
|
|
|
|
Anathema
|
|
Anathema
|
Ok, I cleaned up the spaces, but I'm not sure if it's spaced right or if I have other problems. I also added a 'notice' so when one sets their setinfo, it /notices them. Oops, forgot to mention it still doesn't work.
on *:START:{
hmake setinfo 10
;creates the hash file
if ($isfile(setinfo.htb)) {hload setinfo setinfo.htb}
;loads previous setinfo hash file
.timersave 0 300 hsave -o setinfo setinfo.htb}
;saves the hash file at 5 minute increments
on *:EXIT: {hsave -o setinfo setinfo.htb}
;saves the hash file on exit
on *:TEXT:!setinfo *:#: {if ($2 == $null)
{.notice $nick Your setinfo is: [ $+ $gettok($hget(setinfo,$nick),1,32) $+ ]: $deltok($hget(setinfo,$nick),1,32)
;this is so someone can see what their setinfo is, in private message, for
;whatever reason.
} | elseif ($2 == "delete") {hdel $nick
;to allow someone to delete their setinfo
} | else {hadd setinfo $nick $2
.notice $nick Your setinfo is now $2}
;creates and (should) replace a users setinfo
}
on *:JOIN:#: {if ($nick == ($hmatch(setinfo,$nick)))
{.msg # [ $+ $gettok($hget(setinfo,$nick),1,32) $+ ]: $deltok($hget(setinfo,$nick),1,32)}
;displays the setinfo to the channel that the person joins
Last edited by Anathema; 23/05/03 08:48 PM.
|
|
|
|
|
Joined: Jan 2003
Posts: 2,973
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,973 |
on *:START: {
hmake setinfo 10 | ;creates the hash file
if {($isfile(setinfo.htb)) hload setinfo setinfo.htb | ;loads previous setinfo hash file
.timersave 0 300 hsave -o setinfo setinfo.htb | ;saves the hash file at 5 minute increments
}
on *:EXIT: {
hsave -o setinfo setinfo.htb | ;saves the hash file on exit
}
on *:TEXT:!setinfo *:#: {
if ($2 == $null) {
;this is so someone can see what their setinfo is, in private message, for whatever reason.
.notice $nick Your setinfo is: [ $+ $gettok($hget(setinfo,$nick),1,32) $+ ]: $deltok($hget(setinfo,$nick),1,32)
}
elseif ($2 == "delete") {
hdel $nick | ;to allow someone to delete their setinfo
}
else {
hadd setinfo $nick $2 | ;creates and (should) replace a users setinfo
}
}
on *:JOIN:#: {
if ($nick == ($hmatch(setinfo,$nick))) {
;displays the setinfo to the channel that the person joins
.msg # [ $+ $gettok($hget(setinfo,$nick),1,32) $+ ]: $deltok($hget(setinfo,$nick),1,32)
}
}
My mistake, I also forgot to metion identifiessuch as $aliases, and /commands may not touch the brackets. Also, if you wanted to have the following, using the identifier $nick... How's it going, KingTomato? you must do How's it going, $nick $+ . The $+ will concat the identifier before it, and the statement after it, or vis versa. There is also the $+() alias, that will do the same. Ex: $+($nick,?) Just seperate the items with a comma.
|
|
|
|
|