• Welcome to Valhalla Legends Archive.
 

Mail Script Help

Started by RcP, February 29, 2004, 04:20 PM

Previous topic - Next topic

RcP

So far i have this:Code:
Sub Event_UserTalk(Username, Flags, Message, Ping)
   Dim quote
 
   'If the user is trying to type in a command
   If (Mid(Message, 1, 1) = ".") Then
       Start = 2
       getNextWord Message, Start, myCommand

       Select Case (LCase(myCommand))
           Case "test"
               If (myAccess > -1) Then
                   msgRestOf = Mid(Message, Start)     'Store the users question
                   If (msgRestOf <> Empty) Then        'Make sure they asked a question
                      AddQ "/w *"&Username&" Question recived. Come back later and sheck for a reply"
                      Set FSO = CreateObject("Scripting.FileSystemObject")
                      Set vFile = FSO.OpenTextFile("help.txt",8,True) ' 8 = append
                      vFile.WriteLine(msgRestOf)
                      vFile.Close
                      Set FSO = nothing ' free FSO
                   End If
               End If
       End Select
   End If
End Sub


This writes to the file.

This goes at the end of script.txt allows for rest of the message:
Code:
'Grabs the next word in a message
Sub getNextWord(Message, ByRef Start, ByRef Word)
   
   'Loop through the message until we find the next space
   Do Until (Mid(Message, Start, 1) = " " Or Start > Len(Message))
       Word = Word & Mid(Message, Start, 1)
       Start = Start + 1
   Loop
   
   'Skip the space
   Start = Start + 1

End Sub



Things todo:
Have the message also show the person who asked the question, Time asked (day, hr, min, am/pm).
A read 1 line script for help.txt.
Ability to delete one question at a time.
In the script for reading the questions, Detecting a sertin flag and not alowing other people but them to use the script.



I hope anyone with good VB skills will take this and add onto it. If anyone does plz eather post the end script or anything you add.

[Editor(Grok): added code tags, fixed spelling of 'write']

Stealth

This is a repeat of this post on my VBScript forums:
http://stealthbot.net/forums.php?m=posts&q=2413

So it is worthwhile to note that that is VBScript, not full-fledged VB.
- Stealth
Author of StealthBot

Tuberload

Quote from: Stealth on March 01, 2004, 09:41 AM
This is a repeat of this post on my VBScript forums:
http://stealthbot.net/forums.php?m=posts&q=2413

So it is worthwhile to note that that is VBScript, not full-fledged VB.
Stealing members huh? ;)
Quote"Pray not for lighter burdens, but for stronger backs." -- Teddy Roosevelt
"Your forefathers have given you freedom, so good luck, see you around, hope you make it" -- Unknown

TheMinistered

To incorperate such a mail system you could use 1000 different methods.  I would have one file, a database, to store all mail to be sent out.  Each entry in the table/database would include the sender & the message.  Whenever a message has been read, it is simply deleted from the send database (perhaps added to another?).  This task should not be a difficult one, and if you are finding yourself in trouble then I recommend going back and learning the fundamentals of the language you are using.

Hdx

Bah! Ya that was Stealth_Tech posting in here w/o my permishion but who cares. Ya All i need right now this point in time to get this script working in the bare minamum is a way to have the variable for the username of the person who uses .help witch i have asked for in StealthBot forums.
~-~(HDX)~-~

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status