mIRC Home    About    Download    Register    News    Help

Print Thread
#109933 03/02/05 04:17 AM
Joined: Jan 2005
Posts: 10
W
Pikka bird
OP Offline
Pikka bird
W
Joined: Jan 2005
Posts: 10
Okay, I'm cobbling this together from about four different sources, so I'm learning ehre.

The idea is to have a place where the people in channel can put perosnal info where it can be retrived by others, I'm trying to get it to message the information. I can set the PW for the indivial accounts, I can write the info to file with every user. When i go back and try and read an individual's information with the !whodat <nick>, It doesn't send me the info. When I try the !whodat read command, it simply ends at the break. can anyone see where I went wrong?

on 1:text:!whodat help*:*:{
.timer 1 1 msg $nick Enter all the following commands in a query window.
.timer 1 2 msg $nick !pass <your password> Sets your password with the Whodat system as well as tagline system
.timer 1 3 msg $nick !whodat <pass> <info> To add/change Your Whodat information
.timer 1 4 msg $nick !whodat read Views your information
.timer 1 5 msg $nick Whodat is a system to provide basic information for visitors of the channel. It's for amusement only and we recommend not to use personal info that you would not give a stranger on the street.
.timer 1 6 msg $nick !whodat <nick> to retrieve the selected nicks information
}
on *:TEXT:!whodat*:*:{
if ($readini(mcbpwd.ini,n,$nick,pass) == $null) { /msg $nick please use !pass before setting your whodat information | halt }
if ($readini(mcbpwd.ini,n,$nick,pass) != $hash($2,32)) { /msg $nick the password you supplied is incorrect please try again | halt }
else { /writeini whodat.ini $nick tag $3- | /msg $nick Your whodat information is now set to: | /msg $nick $readini whodat.ini $nick tag }
}
on *:TEXT:!whodat read*:*:{ /msg $nick your present whodat information is : | /msg $nick $readini whodat.ini $nick tag }
}
on *:TEXT:!whodat*:#: {
if ($exists(whodat.ini) == $false) { /msg $nick Sorry $nick $2- Is not known to me. | halt }
else { /msg $nick $readini whodat.ini $nick $ nick tag | halt }
}

#109934 03/02/05 04:59 AM
Joined: Nov 2004
Posts: 332
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Nov 2004
Posts: 332
rather than using a ini you can use a hash table or just a txt
with [headers]
i assume this is in another copy of mirc because you cant trigger on text events yourself


The Kodokan will move you, one way or another.
#109935 03/02/05 05:01 AM
Joined: Nov 2004
Posts: 332
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Nov 2004
Posts: 332
Code:
  
#aliases on
alias HGon {
  if ($group(#greet) == off) {
    enable #greet
    echo 5 -a Hash greet has been turned on.
  }
  else {
    echo 5 -a Hash greet is already on.
  }
}
alias HGoff {
  if ($group(#greet) == on) {
    disable #greet
    echo 5 -a Hash greet has been turned off.
  }
  else {
    acho 5 -a Hash greet is already off.
  }
}
alias HGadd {
  if ($hget(greet)) {
    hadd greet $$1 $$?="Enter the  greeting you want for $1 $+ ."
    echo 5 -a Entry created for $1 $+ .
    hsave greet " $+ $scriptdirgreet.hsh"
  }
  else {
    hmake greet 100
    hadd greet $$1 $$?="Enter the greeting for $1."
    echo 5 -a Entry added for $1 $+ .
    hsave greet " $+ $scriptdirgreet.hsh"
  }
}
alias HGdel {
  if ($hget(greet)) {
    hdel greet $$1
    echo 5 -a Entry for $1 deleted.
  }
  else {
    echo 5 -a Table greet not found.
    echo 5 -a Entry cannot be present.
  }
}
alias HGclear {
  if ($hget(greet)) { 
    hfree greet
    echo 5 -a Table cleared.
  }
}
alias flooda {
  set -su 5 %i on
}
alias floodb {
  set -su5 %j on
}
#aliases end

#HG on
menu nicklist {
  Hash Greet
  .On Off
  ..HG on:HGon
  ..HG off:HGoff
  .Table  
  ..Add:HGadd $$1
  ..Delete:HGdel $$1
  ..Clear:HGclear
}
#HG end

#greet on
on *:start:{ 
  //.timer 0 1800 msg #sensei $!read(babble.txt,n)  
  if ($isfile(greet.hsh)) {      
    hmake greet 100    
    hload -o greet greet.hsh  
  }  
  else { 
    hmake greet 100
    hsave -o greet " $+ $scriptdirgreet.hsh" 
  }
}
on *:exit: { 
  hsave -o greet " $+ $scriptdirgreet.hsh" 
  hfree greet 
}
on @*:join:#: {  
  timer 1 10 mode $chan +l $calc($nick($chan,0) + 1)
  if ($ulevel &gt;= 3) { mode # +q $nick  
    if ($ulevel == 2) { mode # +o $nick
    }
  }  
  if ($hfind(greet, $nick)) {
    msg $chan $nick $+ : $hget(greet, $nick) 
  }
  else { 
    msg $chan Welcome to $chan $+ , $nick $+ . Type !greet &lt;your greeting here&gt; and i will greet you with that every time you join.
  }
}
on @*:text:!greet *:#: { 
  if ((%aa != on) &amp;&amp; ($hget(greet))) {  
    hadd greet $nick $$2-
    echo 5 -a Entry created for $nick $+ .    
    hsave -o greet " $+ $scriptdirgreet.hsh" 
    msg $chan $nick $+ 's greeting was set to: $hget(greet, $nick)
    set -su10 %aa on
  }
  else if (%aa != on) { 
    hmake greet 100
    hadd greet $nick $$2- 
    echo 5 -a Entry created for $nick $+ .
    msg $chan $nick $+ 's greeting was set to: $hget(greet, $nick)
    set -su10 %aa on
  }
}
#greet end

this is a greeting script i have you can easily modify it to suit your needs


The Kodokan will move you, one way or another.
#109936 03/02/05 05:56 AM
Joined: Mar 2004
Posts: 359
L
Fjord artisan
Offline
Fjord artisan
L
Joined: Mar 2004
Posts: 359
Edit your post, thats why there's an edit button.

#109937 03/02/05 07:21 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Two major bugs I saw

Quote:
on *:TEXT:!whodat read*:*:{ /msg $nick your present whodat information is : | /msg $nick $readini whodat.ini $nick tag }
}


This has an extra } braket that isnt needed and can cause problems

Quote:
on *:TEXT:!whodat*:*:{
...
}

on *:TEXT:!whodat*:#: {
...
}


The second of these text event well never be triggered because the first well trip the event, only one TEXT event per script file well trip on a TEXT event.


I added some stuff to your code, take it or turf it, I added comments so as you can see what I did, and maybe adjust it as you need. here it is below.

Code:
on 1:text:!whodat help*:*:{
  .timer 1 1 msg $nick Enter all the following commands in a query window.
  .timer 1 2 msg $nick !pass &lt;your password&gt; Sets your password with the Whodat system as well as tagline system
  .timer 1 3 msg $nick !whodat pass &lt;pass&gt; &lt;info&gt; To add/change Your Whodat information
  .timer 1 4 msg $nick !whodat read Views your information
  .timer 1 5 msg $nick Whodat is a system to provide basic information for visitors of the channel. It's for amusement only and we recommend not to use personal info that you would not give a stranger on the street.
  .timer 1 6 msg $nick !whodat &lt;nick&gt; to retrieve the selected nicks information
}
;
;
;
on *:TEXT:!whodat pass *:*:{
  ;
  ;^ replaced !whodat &lt;pass&gt; with !whodat pass &lt;pass&gt; becuase its hard to identify if a user is entering !whodat &lt;pass&gt; or !whodat &lt;nick&gt;
  ;
  if ($readini(mcbpwd.ini,n,$nick,pass) == $null) { .msg $nick please use !pass before setting your whodat information | halt }
  if ($readini(mcbpwd.ini,n,$nick,pass) != $hash($3,32)) { .msg $nick the password you supplied is incorrect please try again | halt }
  ;
  ;^ removed the ELSE since you are halting the event inside the IF's , so this is done only if above IFs fail.
  ;
  writeini -n whodat.ini $nick tag $4-
  msg $nick Your whodat information is now set to:
  msg $nick $readini(whodat.ini,n,$nick,tag)
  ;
  ;^ replaced the old $readini with the new format $readini()
  ;
}
;
;
;
on *:TEXT:!whodat read:*:{
  ;
  ;^ replaced matchtext "!whodat read*" with "!whodat read" to cover for a !whodat &lt;nick&gt; using a nick starting with Read ie: !whodat ReaderOfMinds
  ;
  if ($readini(whodat.ini,n,$nick,tag)) {
    ;
    ;^ added a check to ensure user exists in whodat database
    ;
    msg $nick your present whodat information is : 
    msg $nick $readini(whodat.ini,n,$nick,tag)
    ;
    ;^ replaced the old $readini with the new format $readini()
    ;
  }
  halt
  ;
  ; ** PLEASE NOTE &gt;&gt;&gt;&gt;&gt; IF you want it to display to a nick "your present whodat information is :" and nothing more if its not set, then remove the above and replace with below.
  ;
  msg $nick your present whodat information is : 
  msg $nick $$readini(whodat.ini,n,$nick,tag)
  ;
  ;^ replaced the old $readini with the new format $readini()and used $$ to stop line if no info
  ;
}
;
;
;
on *:TEXT:!whodat *:*:{
  ;
  ;^ changed # to * to allow for channel or PM's of !whodat &lt;nick&gt;
  ;
  echo -a CP1 t&gt; $target n&gt; $nick c&gt; $chan p&gt; $1-
  if ($readini(whodat.ini,n,$2,tag)) {
    ;
    ;^ added a check to ensure user exists in whodat database
    ;
    msg $iif($chan,$chan,$nick) Present whodat information for $2 is : 
    msg $iif($chan,$chan,$nick) $readini(whodat.ini,n,$2,tag)

  }
  else {
    msg $iif($chan,$chan,$nick) Sorry $nick but $2- is not known to me.
  }
  ;
  ;^ replaced $nick with $iif($chan,$chan,$nick) this well be $chan if in a channel or $nick if in PM, i think theres a $identifier for it but cant think of it.
  ;
}

#109938 04/02/05 01:45 AM
Joined: Jan 2005
Posts: 10
W
Pikka bird
OP Offline
Pikka bird
W
Joined: Jan 2005
Posts: 10
thank you very much for your help, I just got done testing and you fixed what i messed Up. thank you so very much

#109939 04/02/05 06:31 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
ooops

hope you removed this line

echo -a CP1 t> $target n> $nick c> $chan p> $1-

it was a debugging Check point i failed to remove


Link Copied to Clipboard