hi i use myarray or trying to for my commands
but its messed up see this command works,
If CurUser.sName = CStr(owner) Then
If Mid(sCurData, 1, 5 + Len(botname)) = "$To: " & botname Then
MyArray = GetCmdArray(sCurData, ">", ";")
Select Case MyArray(0)
Case "DEMOTE"
If UBound(MyArray, 1) = 1 Then
If demote(MyArray(1)) Then
Curuser.PrivateMessage CStr(botname), MyArray(1) & " is deleted"
Else
Curuser.PrivateMessage CStr(botname), MyArray(1) & " is not a power OP"
End If
Else
Curuser.PrivateMessage CStr(botname), "error may be wrote wrong try - demote;nick"
End If
End Select
End If
End If
but this one dont
If Curuser.bOperator Then
If Mid(sCurData, 1, 1) = "$" Then
privat = 1
End If
MyArray = GetCmdArray(sCurData, ">", ";")
Select Case MyArray(0)
Case "UINFO"
If UBound(MyArray, 1) = 1 Then
Curuser.PrivateMessage CStr(botname), vbCrLf & GetUserInfo(MyArray(1), 1)
Else
Curuser.PrivateMessage CStr(botname), "ERROR::, UINFO;Nick please type again"
End If
End Select
End If
on justintime debugging i get this arror
Microsoft VBScript runtime error: Subscript out of range: '[number: 0]'
and breaks at this line of code
MyArray(1) = UCase(MyArray(0))
strange thing is
demote works like a charm
any idea's
thanks
grrr plz help myarray problem
Moderator: Moderators
grrr plz help myarray problem
ashes to ashes, dust to dust, if the dope dont get you. The acid must
OK, lets see that in a more readable format:
hmm, well apart from the fact that you use UBound(MyArray, 1) uneccesarily (you only have one dimension so UBound(MyArray) would be fine) i can't see much wrong here, next
try CStr(MyArray(1), 1) if its as i assume a text string of a user name that is required here, you may then also want to do
but all i can think of atm
Note: the code snippets given here are 100% untested and may contain syntax errors
Code: Select all
If CurUser.sName = CStr(owner) Then
If Mid(sCurData, 1, 5 + Len(botname)) = "$To: " & botname Then
MyArray = GetCmdArray(sCurData, ">", ";")
Select Case MyArray(0)
Case "DEMOTE"
If UBound(MyArray, 1) = 1 Then
If demote(MyArray(1)) Then
Curuser.PrivateMessage CStr(botname), MyArray(1) & " is deleted"
Else
Curuser.PrivateMessage CStr(botname), MyArray(1) & " is not a power OP"
End If
Else
Curuser.PrivateMessage CStr(botname), "error may be wrote wrong try - demote;nick"
End If
End Select
End If
End If
Code: Select all
If Curuser.bOperator Then
If Mid(sCurData, 1, 1) = "$" Then
privat = 1
End If
MyArray = GetCmdArray(sCurData, ">", ";")
Select Case MyArray(0)
Case "UINFO"
If UBound(MyArray, 1) = 1 Then
Curuser.PrivateMessage CStr(botname), vbCrLf & GetUserInfo(MyArray(1), 1)
Else
Curuser.PrivateMessage CStr(botname), "ERROR::, UINFO;Nick please type again"
End If
End Select
End If
Code: Select all
If ItemByName.(CStr(MyArrary(1))) <> Null ' note: Null is a reserved keyword
Note: the code snippets given here are 100% untested and may contain syntax errors
Need NOT Greed (don't abuse poor countries)
Pay the Poor (increase minimum wage)
Tax the Rich (100% SuperTax rate)
(Do ya think thats maybe a little left-wing?)
Pay the Poor (increase minimum wage)
Tax the Rich (100% SuperTax rate)
(Do ya think thats maybe a little left-wing?)
thanx for reply but yes i did need my array 1 cos i dont want it to take the command demote as the array
also i needed uinfo then name the name info is wanted for will be array 1
anyway what it was is
when a op logged in it ran the code....
the error was no one had said anythoing so array was empty
to solve i just did an if before the if cursuser.boperator
like if If Mid(sCurData, 1, 5 + Len(botname)) = "$To: " & botname Then
so it dident do anything till someone did the command to the bot
but fanx
also i needed uinfo then name the name info is wanted for will be array 1
anyway what it was is
when a op logged in it ran the code....
the error was no one had said anythoing so array was empty
to solve i just did an if before the if cursuser.boperator
like if If Mid(sCurData, 1, 5 + Len(botname)) = "$To: " & botname Then
so it dident do anything till someone did the command to the bot
but fanx
ashes to ashes, dust to dust, if the dope dont get you. The acid must
i was refering to as UBound gives upper bounds of the array and the optional dimension .. , 1) in you case is only really required if you have a two demensional array eg. MyArray(2, 3) not sure what you are refering to but if its now working now thats all you need i guess
Code: Select all
If UBound(MyArray, 1) = 1 Then
Need NOT Greed (don't abuse poor countries)
Pay the Poor (increase minimum wage)
Tax the Rich (100% SuperTax rate)
(Do ya think thats maybe a little left-wing?)
Pay the Poor (increase minimum wage)
Tax the Rich (100% SuperTax rate)
(Do ya think thats maybe a little left-wing?)