Skip to content

Help getting out of infinite roomsend function call

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #188831
    method
    Member

    Hi all i use this code to check for a certain word if it posted in room and if a certain room is posted in room i post back a customed massage. The current code sends infinite massages when a specific word is posted. Could any one tell me what i am doing wrong to just want post back one time instead of infinit times.Thanks

    Private Sub Command1_Click()
    Timer1.Enabled = True
    End Sub


    Private Sub Form_Load()
    Timer1.Enabled = False
    Timer1.Interval = 10
    End Sub

    Private Sub Timer1_Timer()
    On Error Resume Next
    Call LastChatLine
    Call usertext
    Call username
    Text2 = Replace(Text2, Chr(10), "")
    End Sub

    modeule code


    Option Explicit
    ....
    ....
    ....

    Function LastChatLine()

    On Error Resume Next
    Dim LastLine
    Dim lastlen
    Dim TheChatText As String
    Dim TheChars As String
    Dim TheChar As String
    Dim FindChar
    Dim ChatText As String
    ChatText$ = GetChatText
    For FindChar = 1 To Len(ChatText$)
    TheChar$ = Mid(ChatText$, FindChar, 1)
    TheChars$ = TheChars$ & TheChar$
    If TheChar$ = Chr(13) Then
    TheChatText$ = Mid(TheChars$, 1, Len(TheChars$) - 1)
    Form1.RichTextBox1.Text = TheChatText$
    'i added this line
    Form1.Text4.Text = TheChatText$



    Dim txt
    txt = TheChatText$
    If InStr(1, txt, "david") > 0 Then
    Form1.Text4.Text = Replace(txt, "david", "some one mentioned u name")
    'form1.Timer1.Enabled = False
    Call Send("send this massage")===> this is called infinite times!!
    txt = ""
    'form1.Timer1.Enabled = True



    End If

    TheChars$ = ""
    End If
    Next FindChar
    lastlen = Val(FindChar) - Len(TheChars$)
    LastLine = Mid(ChatText$, lastlen, Len(TheChars$))
    LastChatLine = LastLine
    End Function
    #188838

    I read your post and if I undertand you want to do something like this>>>

    1 get a whole last line
    2 validate if the last line has your keyword already defined
    3 send custom message like when you found f***** you will send blablabla this room is rate G some blalbabla are not permited blabla hey 😆

    I’m quite busy, if you dont figure it out one day I have time i will do example for U

    #188837
    method
    Member

    @nanomachine007 wrote:

    I read your post and if I undertand you want to do something like this>>>

    1 get a whole last line
    2 validate if the last line has your keyword already defined
    3 send custom message like when you found f***** you will send blablabla this room is rate G some blalbabla are not permited blabla hey 😆

    I’m quite busy, if you dont figure it out one day I have time i will do example for U

    Thank u for u reply. Yes that is what i want to do . But each time i get in to infinite loops and the massage get sent over and over … . i be happy if u show me how to fix it.Thanks

    #188836

    mabye your problem is this>>> when your bot check ‘david’ and it will send david someone talk to you

    that line still has david keyword so the bot will re-send again the message. to fix that just send a x line after send that message or a flower after your message is sent 😆

    #188835
    method
    Member

    @nanomachine007 wrote:

    mabye your problem is this>>> when your bot check ‘david’ and it will send david someone talk to you

    that line still has david keyword so the bot will re-send again the message. to fix that just send a x line after send that message or a flower after your message is sent 😆

    well i tought about that and the massage that i send has no word david . it has just the sentence some one mentioned your name .Also the name that i in the room is not david either. So there is no way that still finds david .

    After i put that sendroom line problem comes. It either postes infinite time without even some one post the david word!! but if i remove the line i see in my test textbox it detect david and changes it to another sentence so that is not the problem!! try to run the code see what i am talking.

    If InStr(1, txt, "david") > 0 Then

    Form1.Text4.Text = Replace(txt, "david", "some one mentioned u name")

    'form1.Timer1.Enabled = False

    Call Send("send this massage")===> infinite times!!

    txt = ""

    'form1.Timer1.Enabled = True

    End If
    #188834

    ok here it the example i promised you, check it out

    well what it does in this example, it show you how to check the word in last line you got and it will send custom message when the keyword is found.

    #188833
    method
    Member

    Many Many thanks for u nice code.

    May i know how to add user name on post back who posted the search word ?

    #188832

    @method wrote:

    Many Many thanks for u nice code.

    May i know how to add user name on post back who posted the search word ?

    when you get the last line, your line something like this>>>
    username: usertextchat
    you have just do a substring to get the username and oh yeah you can put more keyword like this keyword1;keywork2,keyword3….
    and use function split to split in a tempory table and use loop statement like for or while what ever you prefer 😆

    hint for substring, use instr to find the first position of : and use Left function to get username. I don’t play a lot with vb6 I don’t know if there are other function better than these two functions I give you.

    request loco for source code for do that, I think loco can do it quicky 😆

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.