mIRC Homepage
Posted By: nerdycritter Creating Profile for Chatters Script - 06/09/22 02:57 AM
I know very little about scripting. This script lets individual chatters in the channel create their own profile. Here's the script:

on *:text:!setup:#PowerExchange: {
query $nick You have chosen to setup a profile in #PowerExchange. At any time you wish to change your profile, simply type !setup again and it will overwrite your previous entries. These are fill in the blank questions; type N/A (or whatever you like) to skip question.
query $nick Please answer the following questions here in my PM.
query $nick 58,1 Step 1: What is your age? Type !age (your age)
}

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

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

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

on *:text:!role *:*: {
writeini info $+ .ini $nick role $2-
query $nick 58,1Step 5: What makes you happy-happy-happy? smile Type !happy (What makes you happy)
}

on *:text:!happy *:*: {
writeini info $+ .ini $nick happy $2-
query $nick 58,1Step 6: What are you looking for here online? What are your interests? smile Type !Looking (you're looking for?)
}

on *:text:!looking *:*: {
writeini info $+ .ini $nick Looking $2-
query $nick 58,1Step 7: Up to you to share - what dark passion do you have? Type !Dark (your dark passions)
}

on *:text:!dark *:*: {
writeini info $+ .ini $nick Role $2-
query $nick 58,1Final Step: Now describe yourself. Type !desc (your description)
}

on *:text:!desc *:*: {
writeini info $+ .ini $nick Description $2-
query $nick 58Your profile is now finished. Thank you.
msg #PowerExchange * * * 58,1 $nick has just made a profile. Type 58,1!view $nick to check it out. Type 58,1!setup to make your own.* * *
msg #PowerExchange * * * Profile for $2 * * *
msg #PowerExchange *
msg #PowerExchange * 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)
msg #PowerExchange * Description: $readini(info.ini,n,$2,Description)
msg #PowerExchange *
msg #PowerExchange * * * End of profile * * *
Return
}

on *:text:!view *:#PowerExchange:{
if ($2 != $null) {
if ($ini(info.ini,$2) != $null) var %nick $2
else {
msg $chan Error: no profile for the nickname $2
return
}
}
elseif ($ini(info.ini,$nick) != $null) var %nick $nick
else {
msg $chan Error: no profile for the your nickname $nick
return
}

}


The bot's part is working, messages the user when they type !setup, goes through each question, prompts are working. It stops working when it comes to the end, doesn't send anything to the channel. Then if you type !view <whatever nick> it shows this:

<@TopBanana> * * * has just made a profile. Type !view eunoia{T} to check it out. Type !setup to make your own.* * *
<@TopBanana> * * * Profile for I'm * * *
<@TopBanana> *
<@TopBanana> * Age: - - - Gender: - - - Location: - - - Role:
<@TopBanana> * Description:
<@TopBanana> *
<@TopBanana> * * * End of profile * * *


I've checked and there's an info file saved with the test profile I made. Is it saved in the wrong folder? Or wrong way, ex: ini? Is it just a script error?

Can anyone help please?
Posted By: maroon Re: Creating Profile for Chatters Script - 06/09/22 08:50 PM
What you pasted as a script could not possibly do what you said it did. The coding you have for reacting to !view does nothing except create the local variable named %nick but then doesn't do anything with it. Instead you have the !desc showing the profile.

One problem I see is that you must not have the color code touching $nick or any other identifier. You can be warned of this by going to the options menu of the remote script editor and enabling "identifier warning" which will change the behavior from $no-such-identifier being $null, into instead halting the script with an error telling you which line.

It's harmless to have info $+ .ini instead of info.ini, but it makes the script do a little extra work, and makes it a little harder to read.

When you have a script that doesn't do what you want, one thing that's of big help is to include the -s switch when setting /var so you can see if that line is reached, and if so what value is being set. Or, something echoed to the status window, with enough info so you can find it later to take it out:

echo 4 -s debug: line $scriptline script $script (1-) $1- nick: %nick etc
© mIRC Discussion Forums