StealthBot.net: i'm stuck - StealthBot.net

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

i'm stuck

#1 User is offline   funeral_mist Icon

  • Junior Member
  • PipPip
  • Group: Members
  • Posts: 84
  • Joined: May-07 10

Posted September 22, 2010 - 12:56 AM

so i'm sure this is an easy fix but out of ideas, and i'm new to scripting.

basically i need to convert a array to a string lol

i read a line from a txt file and did split(line, 10)
array(9) has multiple items in it that form a sentence, i did do this x=Left (u_Data (9), Len (u_Data (9)))
and it'll print fine to sb chat window, but i can't get it to print when i try to whisper a user.

also tried join but that didn't work either. hope this makes sense, the end result is i want to be able to whisper a user the items in that array.

thx

#2 User is offline   Hdx Icon

  • Hdx
  • Icon
  • Group: Administrators
  • Posts: 1,359
  • Joined: July-31 09

Posted September 22, 2010 - 01:28 AM

.. a = left(b, len( B) ) is stupid
it is exactly the same as a = b except you make it go through a ton of random useless functions.

Anyways, you will have to be more specific by what you mean not print, and by what you're doing.
Heres a hint, code helps.

This post has been edited by The-Black-Ninja: September 22, 2010 - 01:42 AM

Erin Go Bragh!
Posted Image

#3 User is offline   The-Black-Ninja Icon

  • The Sex
  • Icon
  • Group: Scripting Moderators
  • Posts: 2,526
  • Joined: August-01 09

Posted September 22, 2010 - 01:44 AM

myArray = Array("yes", "no", "maybe")

myStr = vbNullString

For Each item In myArray
   myStr = myStr & item & " "
Next

AddChat vbGreen, myStr

Which results in:

Quote

yes no maybe

This post has been edited by Ribose: September 22, 2010 - 03:56 AM
Reason for edit:: Changed "AddChat vbGreen, output" to "AddChat vbGreen, myStr". Remember your variable names!


#4 User is offline   funeral_mist Icon

  • Junior Member
  • PipPip
  • Group: Members
  • Posts: 84
  • Joined: May-07 10

Posted September 22, 2010 - 03:30 AM

View PostThe-Black-Ninja, on 21 September 2010 - 06:44 PM, said:

myArray = Array("yes", "no", "maybe")

myStr = vbNullString

For Each item In myArray
   myStr = myStr & item & " "
Next

AddChat vbGreen, myStr

Which results in:


ok i did this and addchat works perfect but when i try using addq nothing shows up in channel.

#5 User is offline   The-Black-Ninja Icon

  • The Sex
  • Icon
  • Group: Scripting Moderators
  • Posts: 2,526
  • Joined: August-01 09

Posted September 22, 2010 - 03:50 AM

Post your code.

#6 User is offline   Ribose Icon

  • Fire wants to be free.
  • Icon
  • Group: Global Moderators
  • Posts: 282
  • Joined: July-31 09

Posted September 22, 2010 - 03:55 AM

View Postfuneral_mist, on 21 September 2010 - 11:30 PM, said:

ok i did this and addchat works perfect but when i try using addq nothing shows up in channel.

Show us the line of code you use to call AddQ (wiki). Note that Join() (wiki) will work for Ninja's code:
myArray = Array("yes", "no", "maybe")

myStr = Join(myArray, " ")

AddChat vbGreen, myStr


Without your code, we can only guess at the problem. If it works with AddChat but not AddQ, I can only guess that you are not calling AddQ correctly.
~Ribose
[ Download ] [ Wiki ] [ Support ] [ Scripting ]
[ Chrome ] [ Notepad++ ] [ fedora ]
[ Homepage ] [ BNLS ♯ ]

#7 User is offline   funeral_mist Icon

  • Junior Member
  • PipPip
  • Group: Members
  • Posts: 84
  • Joined: May-07 10

Posted September 22, 2010 - 04:04 AM

Do Until File.AtEndOfStream

    u_Data = Split (File.ReadLine, " ", 10)
    s_Name = u_Data (0)

    If Lcase (u_Name) = Lcase (s_Name) Then

        tMatch = True
        Exit Do

    End If
Loop

If tMatch Then

    u_banArray = u_Data (9)
    u_BanStr = vbNullString

    For Each item In u_banArray
        u_BanStr = u_BanStr & item & " "
    Next

    AddChat vbCyan, "Banned for: " & u_BanStr < works
    AddQ u_BanStr <doesn't work

Else

    AddChat vbRed, "User doesn't exist:" & u_Data (0)

End If


i'm using the user.txt file to get the Ban info, u_Data (9) has it and shows in chat window but not in game with addq.

This post has been edited by AwaKening: September 22, 2010 - 08:10 PM
Reason for edit:: Added code tags and indents


#8 User is offline   Ribose Icon

  • Fire wants to be free.
  • Icon
  • Group: Global Moderators
  • Posts: 282
  • Joined: July-31 09

Posted September 22, 2010 - 04:17 AM

Strange.

Check your string for characters with an Asc() value less than 32 (such as null characters). AddQ ignores messages containing them, so that you don't get IPBanned (I think it should just remove the characters instead of the whole message, but oh well).

A way to do this would be to do:
For C = 1 To Len(u_BanStr)
    If Asc(Mid(u_BanStr, C, 1)) < 32 Then AddChat vbWhite, Asc(Mid(u_BanStr, C, 1))
Next

If you get any numbers printed from that (such as 0 for null or 9 for tab characters), figure out why those are getting into the database or coming out of the database, or strip them at that point, whichever works. If no output comes of that loop, I don't know why AddQ doesn't work.
~Ribose
[ Download ] [ Wiki ] [ Support ] [ Scripting ]
[ Chrome ] [ Notepad++ ] [ fedora ]
[ Homepage ] [ BNLS ♯ ]

#9 User is offline   AwaKening Icon

  • how do ya like me now
  • Icon
  • Group: Scripting Moderators
  • Posts: 977
  • Joined: August-20 09

Posted September 22, 2010 - 08:16 PM

I don't see how this is working at all for you (even addchat). Your code is messed up. Please look at my notes in this portion of your code.

u_banArray = u_Data (9)  '// You're just creating a string, not an array
u_BanStr = vbNullString

For Each item In u_banArray    '// This will fail because it's not an array; therefore leaving u_BanStr empty
    u_BanStr = u_BanStr & item & " "
Next


You should be getting an error (object not a collection) at the time it hits your loop.

I'm going to guess that this is what you want.

Do Until File.AtEndOfStream

    u_Data = Split (File.ReadLine, " ", 10)
    s_Name = u_Data (0)

    If Lcase (u_Name) = Lcase (s_Name) Then

        tMatch = True
        Exit Do

    End If
Loop

If tMatch Then

    AddChat vbCyan, "Banned for: " & u_Data(9)
    AddQ u_Data(9)

Else

    AddChat vbRed, "User doesn't exist:" & u_Data (0)

End If


If not, then please provied more of your code or explain better.

#10 User is offline   funeral_mist Icon

  • Junior Member
  • PipPip
  • Group: Members
  • Posts: 84
  • Joined: May-07 10

Posted September 23, 2010 - 01:27 AM

Hi, yes you're right. After having to restart the bot today i now get that error (object not a collection) now.

All i'm trying to do is have ban info either displayed in channel or whispered to a user. i've managed to get everything
working except the part with the ban info to display.

User: user1 was banned by user2
Ban was created on: 00/00/00 (i haven't formatted date yet)
Reason for ban: xxx xxx xxx

is what i'm going for, xxx xxx xxx is what i'm having problems getting to display. Below is my code as of now...

Sub who_banned (Command, u_Name)


AddChat vbRed, "Searching user database for " & u_Name & " ... "

tMatch = False

Set FSO = CreateObject ("Scripting.FileSystemObject")
Set File = FSO.OpenTextFile (BotPath & "Users.txt", 1, True)


Do Until File.AtEndOfStream

u_Data = Split (File.ReadLine, " ", 10)
s_Name = u_Data (0)

If Lcase (u_Name) = Lcase (s_Name) Then

tMatch = True
Exit Do

End If

Loop

If tMatch Then

AddChat vbGreen, "User found, returning info:"
AddChat vbCyan, "User: " & u_Data (0) & " was banned by " & u_Data (3)
AddChat vbCyan, "Ban was created on: " & u_Data (4)
AddChat vbCyan, "Reason for ban: " & u_Data (9)

AddQ "User: " & u_Data (0) & " was banned by " & u_Data (3)
AddQ "Ban was created on: " & u_Data (4)
AddQ "Reason for ban: " & u_Data (9)


Else

AddChat vbRed, "User doesn't exist:" & u_Data (0)
AddQ "/w funeral_mist User: " & u_Name & " doesn't exist."


End If

File.Close
Set File = Nothing


End Sub

The array items in u_Data (9) display properly with addchat in chat window. :(

#11 User is offline   The-Black-Ninja Icon

  • The Sex
  • Icon
  • Group: Scripting Moderators
  • Posts: 2,526
  • Joined: August-01 09

Posted September 23, 2010 - 01:46 AM

Give me a minute or two. Could you provide me with the users.txt line for a banned user?

#12 User is offline   funeral_mist Icon

  • Junior Member
  • PipPip
  • Group: Members
  • Posts: 84
  • Joined: May-07 10

Posted September 23, 2010 - 02:24 AM

View PostThe-Black-Ninja, on 22 September 2010 - 06:46 PM, said:

Give me a minute or two. Could you provide me with the users.txt line for a banned user?


User1 0 B User2 17-08-2010_10:25:06 User2 17-08-2010_10:25:06 USER % Don't host my runs.

#13 User is offline   The-Black-Ninja Icon

  • The Sex
  • Icon
  • Group: Scripting Moderators
  • Posts: 2,526
  • Joined: August-01 09

Posted September 23, 2010 - 03:12 AM

Something like this?
Sub who_banned (Command, u_Name)
   
   AddChat vbRed, "Searching user database for " & u_Name & " ... "
   
   tMatch = False

   Set FSO = CreateObject ("Scripting.FileSystemObject")
   Set File = FSO.OpenTextFile (BotPath & "Users.txt", 1, True)

   Do Until File.AtEndOfStream
      ''// Only parse out the username initially, then once it's a match, filter out the remaining data so you're not doing useless operations
      s_name = Split(File.ReadLine)(0)

      If Lcase (u_Name) = Lcase(s_Name) Then
         line = File.ReadLine
         bCreation = Split(line)(6)
         bUser = Split(line)(5)
         reason = Mid(line, InStr(line, "% ")+1)
         tMatch = True
         Exit Do
      End If
   Loop

   If tMatch Then
      AddChat vbGreen, "User found, returning info:"
      AddChat vbCyan, "User: " & u_Name & " was banned by " & bUser
      AddChat vbCyan, "Ban was created on: " & bCreation
      AddChat vbCyan, "Reason for ban: " & reason
   Else
      AddChat vbRed, "User doesn't exist:" & u_Name
      AddQ "/w funeral_mist User: " & u_Name & " doesn't exist."
   End If

   File.Close
   Set File = Nothing
   Set fso = Nothing
End Sub


#14 User is offline   Hdx Icon

  • Hdx
  • Icon
  • Group: Administrators
  • Posts: 1,359
  • Joined: July-31 09

Posted September 23, 2010 - 03:22 AM

Update to the build tomarrow night, And you can do:
GetDBEntry("Name").BanMessage
(It was in the DBEntry object, nobody ever implemented it though)

It will be built and available at 9pm tomorrow night.
Erin Go Bragh!
Posted Image

#15 User is offline   The-Black-Ninja Icon

  • The Sex
  • Icon
  • Group: Scripting Moderators
  • Posts: 2,526
  • Joined: August-01 09

Posted September 23, 2010 - 03:47 AM

Nicely done, sir.

#16 User is offline   funeral_mist Icon

  • Junior Member
  • PipPip
  • Group: Members
  • Posts: 84
  • Joined: May-07 10

Posted September 23, 2010 - 03:53 AM

well now it reads info from the next line in the user file, and it still doesn't
display in the game channel with addq for some reason. :/

if there is a new version coming out tomorrow then i'll just scrap this till then.

thanks everyone for the help. kinda sucks being new at something but i love the learning
part. i miss using autocad/ldd and making lisp routines so this is filling my void :D

#17 User is offline   The-Black-Ninja Icon

  • The Sex
  • Icon
  • Group: Scripting Moderators
  • Posts: 2,526
  • Joined: August-01 09

Posted September 23, 2010 - 04:34 AM

All you need to do is replace "AddChat vbGreen, " with AddQ
AddQ "User found, returning info:"


You write AutoCAD LISP too? What have you done? I've made a routine that automatically generates a "table of contents" with lines and text; it reads all the dwg files within a folder and puts them into the table. I've also made a volume calculator for stormwater retention ponds where you choose two closed polylines and based on their elevation difference, it will tell you how much volume they can hold and what the side slopes are, but it's pretty dirty because if you misclick, the routine ends, which sucks.

If you've been doing this for a bit, I could use some help because I'm still pretty new to LISP in AutoCAD.

#18 User is offline   funeral_mist Icon

  • Junior Member
  • PipPip
  • Group: Members
  • Posts: 84
  • Joined: May-07 10

Posted September 23, 2010 - 05:14 AM

i've done custom menus with macros for basic stuff to lsp routines that did custom labeling (last job was a civil joint and i did final plats and lot layouts)etc. i didn't use ldd
much so i created my own stuff. never got around to the db stuff tho, like ldd project data like i wanted to. i've been away from it for about a year but i'd be glad to help if i
can.

#19 User is offline   The-Black-Ninja Icon

  • The Sex
  • Icon
  • Group: Scripting Moderators
  • Posts: 2,526
  • Joined: August-01 09

Posted September 23, 2010 - 12:15 PM

LDD is terrible lol Thankfully my company has converted all our old projects to Civil before I started, but yeah, I'll PM you.

#20 User is offline   funeral_mist Icon

  • Junior Member
  • PipPip
  • Group: Members
  • Posts: 84
  • Joined: May-07 10

Posted September 24, 2010 - 10:51 PM

View PostHdx, on 22 September 2010 - 08:22 PM, said:

Update to the build tomarrow night, And you can do:
GetDBEntry("Name").BanMessage
(It was in the DBEntry object, nobody ever implemented it though)

It will be built and available at 9pm tomorrow night.


today?

#21 User is offline   PhiX Icon

  • Notice the ownage.
  • Icon
  • Group: Administrators
  • Posts: 8,388,607
  • Joined: July-31 09

Posted September 24, 2010 - 11:03 PM

http://www.stealthbo...lthBotSetup.msi
PhiX

BNLS: phix.no-ip.org

Please refrain from sending me personal messages regarding technical support issues. Use the forums, that is what they are there for.

#22 User is offline   funeral_mist Icon

  • Junior Member
  • PipPip
  • Group: Members
  • Posts: 84
  • Joined: May-07 10

Posted September 25, 2010 - 12:32 AM

View PostPhiX, on 24 September 2010 - 04:03 PM, said:



thank you! :D

Quote

Update to the build tomarrow night, And you can do:
GetDBEntry("Name").BanMessage
(It was in the DBEntry object, nobody ever implemented it though)

It will be built and available at 9pm tomorrow night.


Does this mean that the user file is now a .ini? the version i just got still using .txt

#23 User is offline   Hdx Icon

  • Hdx
  • Icon
  • Group: Administrators
  • Posts: 1,359
  • Joined: July-31 09

Posted September 25, 2010 - 12:47 AM

Whoever said anything about inis?
Erin Go Bragh!
Posted Image

#24 User is offline   The-Black-Ninja Icon

  • The Sex
  • Icon
  • Group: Scripting Moderators
  • Posts: 2,526
  • Joined: August-01 09

Posted September 25, 2010 - 01:06 AM

User file is users.txt

#25 User is offline   funeral_mist Icon

  • Junior Member
  • PipPip
  • Group: Members
  • Posts: 84
  • Joined: May-07 10

Posted September 25, 2010 - 03:16 AM

i just needed to figure out how to use it is all ... and WOW did it cut so much code out, thanks! :D

This post has been edited by funeral_mist: September 25, 2010 - 03:17 AM


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users