mIRC Home    About    Download    Register    News    Help

Print Thread
How to call a profile using !view <nick> ??? #246619 22/06/14 03:56 PM
Joined: Jun 2014
Posts: 6
R
raggie Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Jun 2014
Posts: 6
I wrote a profile script so visitors to my channel can make profiles for others to view. So far, a visitor can make a profile, edit it if need be, and view their own profile. The problem is, if someone tries to view another person's profile, it only shows the profile of the person typing !view <nick>. I don't know how to make it so others can call up another person's profile using !view <nick>

Can someone help me please?

Last edited by raggie; 22/06/14 04:02 PM.
Re: How to call a profile using !view <nick> ??? [Re: raggie] #246620 22/06/14 04:44 PM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
What informations you want to display when someone types !view <nick> ?

Also please paste the code that you have to understand the way that you have script it to help you better.

Last edited by westor; 22/06/14 04:44 PM.
Re: How to call a profile using !view <nick> ??? [Re: westor] #246622 22/06/14 05:16 PM
Joined: Jun 2014
Posts: 6
R
raggie Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Jun 2014
Posts: 6
When !view <nick> is used, I want it to display the profile info found in the .ini file for the nick specified after !view.

So what is the way to do that?

Here is my profile script...


on *:text:!setup:#ChanName: {
query $nick Please answer the following questions here in my PM.
query $nick What is your age? Type !age (your age)
}

on *:text:!age *:*: {
writeini info $+ .ini $nick Age $2-
query $nick What is your gender? Type !gender (your gender)
}

on *:text:!gender *:*: {
writeini info $+ .ini $nick Gender $2-
query $nick What is your location? Type !location (your location)
}

on *:text:!location *:*: {
writeini info $+ .ini $nick Location $2-
query $nick What is your role? Type !role (your role)
}

on *:text:!role *:*: {
writeini info $+ .ini $nick Role $2-
query $nick Now describe yourself. Type !desc (your description)
}

on *:text:!desc *:*: {
writeini info $+ .ini $nick Description $2-
query $nick Your profile is now finished. Thank you.
msg #ChanName * * * $nick has just made a profile. Type !view $nick to check it out. * * *
Halt
}

on *:text:!view *:#ChanName: {
/notice $nick * * * Profile for $nick * * * | /notice $nick * | /notice $nick Age: $readini(info $+ .ini,$nick,Age) - - - Gender: $readini(info $+ .ini,$nick,Gender) - - - Location: $readini(info $+ .ini,$nick,Location) - - - Role: $readini(info $+ .ini,$nick,Role) | /notice $nick * | /notice $nick Description: $readini(info $+ .ini,$nick,Description) | /notice $nick * | /notice $nick * * * End of profile * * *
Halt
}

Last edited by raggie; 22/06/14 06:14 PM.
Re: How to call a profile using !view <nick> ??? [Re: raggie] #246623 22/06/14 08:00 PM
Joined: Jul 2006
Posts: 3,530
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,530
If you made that script, you should understand that $nick refers to the nickname typing the text, when typing !view <nick>, you want to use <nick> instead of $nick, <nick> is just the second parameter, $2 .

You used $2 in your others on text event to get each informations, here it's the same.


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: How to call a profile using !view <nick> ??? [Re: Wims] #246625 22/06/14 08:14 PM
Joined: Jun 2014
Posts: 6
R
raggie Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Jun 2014
Posts: 6
I know $nick means the nick of the person typing.

As for the rest of what you said, it makes no sense to me.

Could you provide a snippet?

Re: How to call a profile using !view <nick> ??? [Re: raggie] #246626 22/06/14 08:25 PM
Joined: Jul 2006
Posts: 3,530
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,530
Sure.
In your situation, you have the nick who sent the message, $nick, and the nick specified after !view, which is the second word of the message, $2, and I quote:
Quote:
When !view <nick> is used, I want it to display the profile info found in the .ini file for the nick specified after !view.


Note also that you must always use the 'n' switch with $readini when you don't want to evaluate the line being read, this is unsafe and in a typical script like this (and it's the case here) there is an exploit, people can use the current script here to do anything they want on your computer, you can read more about it here .

Code:
on *:text:!view *:#ChanName: {
;this check that $2, the nickname, is specified and that we have a profile for that nickname
if ($2 != $null) && ($ini(info.ini,$2) != $null) {
/notice $nick * * * Profile for $2 * * *
/notice $nick *
;no need to use info $+ .ini, info.ini is just fine, maybe you had something before..
/notice $nick Age: $readini(info.ini,n,$2,Age) - - - Gender: $readini(info.ini,n,$2,Gender) - - - Location: $readini(info .ini,n,$2,Location) - - - Role: $readini(info.ini,n,$2,Role) | /notice $nick *
/notice $nick Description: $readini(info.ini,n,$2,Description) 
/notice $nick * 
/notice $nick * * * End of profile * * *
;no need to halt here
}
}

Last edited by Wims; 22/06/14 08:32 PM.

Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: How to call a profile using !view <nick> ??? [Re: Wims] #246627 22/06/14 08:29 PM
Joined: Jun 2014
Posts: 6
R
raggie Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Jun 2014
Posts: 6
Wims... I just tried it and it did nothing.

Re: How to call a profile using !view <nick> ??? [Re: raggie] #246629 22/06/14 08:38 PM
Joined: Jul 2006
Posts: 3,530
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,530
Are you typing only "!view"? You must give a nickname here
If you are giving a nickname, make sure it has an entry in the ini file, it should work


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: How to call a profile using !view <nick> ??? [Re: Wims] #246630 22/06/14 08:45 PM
Joined: Jun 2014
Posts: 6
R
raggie Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Jun 2014
Posts: 6
I'm typing in a nick after !view and there is an entry for that nick.

Also, I get know where to put the 'n' switch element nor the correct way to use it.


Last edited by raggie; 22/06/14 09:27 PM.
Re: How to call a profile using !view <nick> ??? [Re: raggie] #246632 22/06/14 09:51 PM
Joined: Jul 2006
Posts: 3,530
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,530
Note: you edited your post but it was originally saying that the script only worked when specifying a nickname

Yes, that was intended because you didn't state you wanted both and I didn't assume so. You have to use an if statement and to use $nick in one case and $2 for the other:
Code:
on *:text:!view *:#ChanName:{
  ;the code will use the variable %nick for the profile, either set to $2 or to $nick
  if ($2 != $null) {
    if ($ini(info.ini,$2) != $null) var %nick $2
    else {
     msg $chan Error: no profile for the nickname $2
     ;after an error, you don't want to keep going with the profile so you /return, using /halt is not necessary and can have consequences on the rest of the loaded scripts
     return
    }
  }
  elseif ($ini(info.ini,$nick) != $null) var %nick $nick
  else {
   msg $chan Error: no profile for the your nickname $nick
   return
  }
  /notice $nick * * * Profile for %nick * * *
  /notice $nick *
  /notice $nick Age: $readini(info.ini,n,%nick,Age) - - - Gender: $readini(info.ini,n,%nick,Gender) - - - Location: $readini(info.ini,n,%nick,Location) - - - Role: $readini(info.ini,n,%nick,Role) | /notice $nick *
  /notice $nick Description: $readini(info.ini,n,%nick,Description) 
  /notice $nick * 
  /notice $nick * * * End of profile * * *
  }
}
The 'n' switch on $readini is there, switches go after the filename in $readini

Last edited by Wims; 22/06/14 09:55 PM.

Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: How to call a profile using !view <nick> ??? [Re: Wims] #246633 22/06/14 11:25 PM
Joined: Jun 2014
Posts: 6
R
raggie Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Jun 2014
Posts: 6
Wims, I'm sorry for the mix up earlier.

You did solve my problem tho. Thank you so much. smile