Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ VBscript
➜ Yes, another Database question
|
Yes, another Database question
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Loki_edmud
(5 posts) Bio
|
| Date
| Tue 03 Aug 2004 07:56 PM (UTC) |
| Message
| Ok, I have ready through the Forums but nothing made sense in what I wanted to do.
I wanted to create something like a Buddy List.
Basically I am trying to create a script that add a name of a player to a list of names in a text file.
Then I am trying to make a function that would allow me
load the names from the list and compare and arguement
against the the list of names.
also want something to automatically add a new name to the list if a name is not there, for example if a player introduces themselves to me.
Can someone please direct me to a good exampl of this.
I look ed at the example for Mud Database, a bit complicated for me.
the naems on the text file would be as simple as
errin
draken
wkiki
Bunata
buwawa
| | Top |
|
| Posted by
| Flannel
USA (1,230 posts) Bio
|
| Date
| Reply #1 on Tue 03 Aug 2004 10:00 PM (UTC) Amended on Tue 03 Aug 2004 10:03 PM (UTC) by Flannel
|
| Message
| Do you really need a database for it?
Just use a MC variable, and add a | in between the names. Then to compare, you can just insert the variable (@!namelist) and expand variables, and it'll evaluate like a regular expression.
Your variable contents would be...
joe|bob|nick|phil
Or, if you need data to work a bit differently, you could use an array, you can look at the list of functions for all the array things. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | | Top |
|
| Posted by
| Loki_edmud
(5 posts) Bio
|
| Date
| Reply #2 on Tue 03 Aug 2004 10:19 PM (UTC) |
| Message
| Well I hope to in the to possibly addon to this. possibly
store other info later on down the rod tht is when I get back into the swing of things.
possibly like this:
testguy, warrior
testguy2, mage
so not too far down the line after that I could
possibly keep party stats or what not. I would
like to be able to keep this in a text file that
the script could look for at a later time.
I know little about Arrays, I should say I remember little
I know how to wrok with them with in the script. But I have no clue to to have the array save to a txt file
how to add an array automatically, or how i would load the arrays offf the text file.
I just need a clear example I guess, I don't wnat anyone to just give me the answer but I would appreciate it it I were pointed to the right direction of a nice example.
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Thu 05 Aug 2004 09:00 PM (UTC) Amended on Thu 05 Aug 2004 09:01 PM (UTC) by Nick Gammon
|
| Message
| |
| Posted by
| Loki_edmud
(5 posts) Bio
|
| Date
| Reply #4 on Fri 06 Aug 2004 05:21 AM (UTC) |
| Message
| Thank you Nick.
This is what I am trying to do just to get a start
I am using THis as the trigger
" * has joined your party"
`This Triggers sends the wildcard
`to my script named "MyTrigger"
sub MyTrigger (name, line, wildcards)
Dim pname, checkname
pname = Wildcards(1)
checkname = ArrayKeyExists ("namelist", pname)
If checkname = TRUE then
world.note " This Person is already on your member's list"
else
ArraySet "namelist", pname
SetVariable "namelist", ArrayExport ("namelist", ",")
world.note "You have added " & pname & " to your member list"
If ArraySize ("namelist") <2 then
world.note "You currently have " & ArraySize ("namelist") & "member"
else
world.note "You currently have " & ArraySize ("namelist") & "members"
endif
end sub
And of course I am sure that you know that this does not work. I am just not sure what I am doing wrong. | | Top |
|
| Posted by
| Loki_edmud
(5 posts) Bio
|
| Date
| Reply #5 on Fri 06 Aug 2004 06:01 AM (UTC) |
| Message
| Ok Ok Ok, I am a dummy.
First I would like to take everyone for the help.
Nick You were a Big help. THe answer was right in front of my face. There is an example of what I needed to do in the example script that I am using lol. So this
is what I did:
I am going resuse the code that is in the example script"
AddItem (listname, item) and Ismember(listname, membername)
sub MyTrigger (name, line, wildcards)
Dim pname, listname
listname = "namelist"
If IsMember (listName, pname) then
world.note "You know " & pname & " already !!"
else
AddItem listname, pname
world.note "You have added " & pname & " to the member list."
End if
end sub
Thanks a lot Guys!!
| | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
21,510 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top