Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: RcP on February 29, 2004, 04:20 PM

Title: Mail Script Help
Post by: RcP on February 29, 2004, 04:20 PM
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']
Title: Re:Mail Script Help
Post by: 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.
Title: Re:Mail Script Help
Post by: Tuberload on March 02, 2004, 01:32 AM
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? ;)
Title: Re:Mail Script Help
Post by: TheMinistered on March 02, 2004, 07:15 AM
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.
Title: Re:Mail Script Help
Post by: Hdx on March 02, 2004, 07:21 PM
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)~-~