Author Topic: Profile script needed  (Read 48 times)

angelicwhimpers

  • Newbie
  • *
  • Posts: 10
Profile script needed
« on: February 21, 2015, 05:42:25 PM »

 i have a hard script i would love to have made... it is a profile script. i would like that apon entering the room it will either state; they do not have a profile and can set one up by typeing !setup, or it will show the intro that they have entered before when they set up the profile previsly.

i would like the profile to have 10 different feilds, such as age, location, description, and so on (can fill in the names of the feilds later) for now we can list them as FEILD 1 , FEILD 2, FEILD 3, and so on... the last feild would be the intro, the thing used when the person enters the room.

to beable to see the profile for any said person someone would type in something like !view <nick>. when that is typed that person will get a notice or msg with the profile of the person they wish to see (if they person dosnt have a profile it would tell them, <nick> dose not have a profile yet.) if there is a profile they would then get a msg or notice with said info... ex.

Profile for <nick>
Age: <person fills in>
Sex: <person fills in>
Location: <person fills in>
FEILD 4: <person fills in>
FEILD 5: <person fills in>
FEILD 6: <person fills in>
FEILD 7: <person fills in>
FEILD 8: <person fills in>
FEILD 9: <person fills in>
Intro: <person fills in>

when a person first joins the room it would find there profile in his memorie bank and send out the persons intro then after it say something like "For there full profile please type !view <nick>."

i hope that makes sense and you can understand it. would greatly love anyone that could help me out!!!
if it helps i am running icechat 7.8

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 253
Re: Profile script needed
« Reply #1 on: February 23, 2015, 07:50:28 AM »
Writing this script would not be too challenging, but it's a lot of mechanical work, which is why I think you'll have trouble finding someone to do it for you. You can of course as for help if you have specific questions.

I would suggest you store the information in an ini file. This unfortunately limits each entry to 255 characters unless you make your own parser for ini files, but depending on what you want people to enter into the different fields, 255 characters might be enough.

Code: [Select]
WriteIniFile "somefile.ini", "section", "item", "value"
GetIniFile("somefile.ini", "section", "item","defaultvalue")

If the ini file does not contain what you are trying to search for it will return "defaultvalue"


So, first you need to make a command that allows people to store information to their profile. This could be done by having them type "!set age xx" or "!set sex xx" (without quotes). This could be done by something like this inside a ONTEXT or ONQUERY sub:

Code: [Select]
If Left(Message,5) = "!set " and len(Message) >5 then
messageArr = Split(Message," ") 'split the message into an array where each word is one item in the array
If UBound(messageArr) < 2 then exit sub 'there needs to be at least 3 words, otherwise the script terminates
Select Case messageArr(1) 'look at the second word
Case "age"
WriteIniFile "somefile.ini", Nickname, "age", messageArr(2) 'store the third word into the ini file
Case "sex"
WriteIniFile "somefile.ini", Nickname, "sex", messageArr(2)
Case "description"
WriteIniFile "somefile.ini", Nickname, "description", Mid(Message,17) 'store everything after !set description
End Select
End If

To retrieve the information you can pretty much do the same, but use something like:

Code: [Select]
SomeVariable = GetIniFile("somefile.ini", Nickname, "age", "")

You might want to add some code to check that you aren't trying to store more than 255 characters like:
Code: [Select]
If Len(SomeString) > 255 then...

If you don't want to use ini files, you can for example use for example an access database which allows for much more functionality than ini files, but you will have to figure out that by yourself as databases are not something I'm very familiar with.
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

angelicwhimpers

  • Newbie
  • *
  • Posts: 10
Re: Profile script needed
« Reply #2 on: February 23, 2015, 09:52:43 PM »
none of this is something i am very fimiliar with i can change things and tweek things but so far that is all.

angelicwhimpers

  • Newbie
  • *
  • Posts: 10
Re: Profile script needed
« Reply #3 on: February 23, 2015, 10:16:02 PM »
okies so this is gonna be a really stupid question but the ONQUERY thing that query is a pm msg right?

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1842
    • IceChat IRC Client
Re: Profile script needed
« Reply #4 on: February 24, 2015, 08:58:29 AM »
Correct, a Query is just another word for a Private Message.
The IceChat God