StealthBot.net: Problem with running script? - StealthBot.net

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Problem with running script?

#1 User is offline   Damein Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 6
  • Joined: January-01 12

Posted October 30, 2015 - 06:02 AM

We created this script and it works 100% on someone else's PC but for me it won't work at all.

He can copy/paste the code to me and send me the entire text file as is on his PC and it won't work.

I've noticed that if I take out the

teamrand_


From the commands they work but with errors because it doesn't seem to detect other things.

Can't quite understand why this is. Any ideas?

'teamrand
'1.0

'&Team Randomizer
'&pickteams
'&
'&Type "/me" or "/emote" to register yourself while teams are being picked


Public Const teamrand_iSeconds = 30
Public Const teamrand_iMaxPlayers = 6

Public teamrand_bRegister, teamrand_iPlayerCount, teamrand_oDict

Sub teamrand_Event_Load()
Randomize
teamrand_bRegister = False
teamrand_iPlayerCount = 0
TimerInterval "teamrand", "Register", 30
Set teamrand_oDict = CreateObject("Scripting.Dictionary")
End Sub

Sub teamrand_Event_UserTalk(Username, Flags, Message, Ping)
If LCase(Left(Message, 10)) = BotVars.Trigger & "league" And teamrand_bRegister = False Then
sAccess = GetDBEntry(Username).Flags
If sAccess = "MLS" OR sAccess = "MLSX" Then
AddQ "4-6 Players Required. Randomizing partners and players who must sit in " & teamrand_iSeconds & " seconds. Type " & BotVars.Trigger & "agree to register for this game."
teamrand_bRegister = True
teamrand_iPlayerCount = 0
TimerEnabled "teamrand", "Register", True
Else
fakeCommand = ""
End If
End If
If LCase(Left(Message, 10)) = BotVars.Trigger & "agree" Then
sAccess = GetDBEntry(Username).Flags
If sAccess = "MLS" OR sAccess = "MLSX" Then
If teamrand_bRegister = True Then
If teamrand_iPlayerCount = teamrand_iMaxPlayers Then
AddQ teamrand_iMaxPlayers & " players are already registered."
Else
If teamrand_oDict.Exists(Username) Then
AddQ Username & " is already registered."
Else
AddQ "Added " & Username & " to game."
teamrand_iPlayerCount = teamrand_iPlayerCount + 1
teamrand_oDict.Add Username, "Player" & teamrand_iPlayerCount
End If
End If
End If
End If
End If
End Sub



Sub teamrand_Register_Timer()
Dim aPlayers(12)
teamrand_bRegister = False
TimerEnabled "teamrand", "Register", False
AddQ "" & teamrand_iPlayerCount & " players have signed up."
If teamrand_iPlayerCount < 4 Then
AddQ "Not enough players registered. Please try again."
teamrand_oDict.RemoveAll
Exit Sub
End If

AddQ "Randomizing teams now..."

'// Populate Array based on dictionary
X = 0
For Each Username In teamrand_oDict.Keys
X = X + 1
aPlayers(X) = Username
Next

'// Swap random elements of the array to shuffle the players
For X = 1 to 500
iA = teamrand_RanNum(1,teamrand_iPlayerCount)
iB = teamrand_RanNum(1,teamrand_iPlayerCount)
sA = aPlayers(iA)
sB = aPlayers(iB)
aPlayers(iA) = sB
aPlayers(iB) = sA
Next

If teamrand_iPlayerCount = 4 Then
sTeam1 = ""
sTeam2 = ""
For X = 1 to 2
sTeam1 = sTeam1 & aPlayers(X) & " || "
Next
For X = (Int(teamrand_iPlayerCount/2) + 1) to 4
sTeam2 = sTeam2 & aPlayers(X) & " || "
Next


AddQ "Xtreme HOT: || " & sTeam1
AddQ "Xtreme COLD: || " & sTeam2

teamrand_oDict.RemoveAll
End If

If teamrand_iPlayerCount = 5 Then
sTeam1 = ""
sTeam2 = ""
sTeam3 = ""
For X = 1 to 2
sTeam1 = sTeam1 & aPlayers(X) & " || "
Next
For X = (Int(teamrand_iPlayerCount/2) + 1) to 4
sTeam2 = sTeam2 & aPlayers(X) & " || "
Next
For X = (Int(teamrand_iPlayerCount/2) + 3) to teamrand_iPlayerCount
sTeam3 = sTeam3 & aPlayers(X) & " "
Next


AddQ "Xtreme HOT: || " & sTeam1
AddQ "Xtreme COLD: || " & sTeam2
AddQ "Players sitting out: " & sTeam3

teamrand_oDict.RemoveAll
End If

If teamrand_iPlayerCount = 6 Then
sTeam1 = ""
sTeam2 = ""
sTeam3 = ""
For X = 1 to 2
sTeam1 = sTeam1 & aPlayers(X) & " || "
Next
For X = (Int(teamrand_iPlayerCount/2) + 1) to 5
sTeam2 = sTeam2 & aPlayers(X) & " || "
Next


AddQ "Xtreme HOT: || " & sTeam1
AddQ "Xtreme COLD: || " & sTeam2
AddQ "!! All other players must sit out !!"

teamrand_oDict.RemoveAll
End If

End Sub

'// Used to get a random number between minimum and maximum.
Function teamrand_RanNum(minimum, maximum)
teamrand_RanNum = Int(((maximum + 1) - (minimum)) * Rnd + (minimum))
End Function


#2 User is offline   PhiX Icon

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

Posted October 30, 2015 - 08:53 AM

The is the old team randomizer plugin included in the Plugin System. If you tried to add it as a script, it might cause errors. Use the converted script version instead.
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.

#3 User is online   Eric Icon

  • Diamond Member
  • Icon
  • Group: Administrators
  • Posts: 8,388,607
  • Joined: July-31 09

Posted October 30, 2015 - 03:32 PM

https://i.imgur.com/snLplqq.jpg

#4 User is offline   Damein Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 6
  • Joined: January-01 12

Posted October 30, 2015 - 05:07 PM

I realize he didn't have the author info in it, like I said I was getting this from someone else.

When I said "we" I meant someone in the community I play in. I apologize if I made it sound like we were trying to take credit. Misspoken ^^;

But why can he use it but I can't ... ? Old Stealthbot version?


Oh, and also all the download links bring me to an error stating

Quote

[#10173] We could not find the attachment you were attempting to view.

This post has been edited by Damein: October 30, 2015 - 05:09 PM


#5 User is offline   PhiX Icon

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

Posted November 01, 2015 - 08:06 PM

View PostDamein, on October 30, 2015 - 06:07 PM, said:

But why can he use it but I can't ... ? Old Stealthbot version?
He is definitely using the Plugin System, which still works with v2.7, but is not supported anymore. You can try to use it, but in case of errors you're on your own.

StealthBot used to have the Plugin System pre-installed, not sure if that's still the case. You can check if it is listed as one of your scripts (type "/scripts" in your bot or check the Scripting menu). If it is, and if it is enabled, you can simply install the plugin by typing "/getplugin teamrand" in your bot.

View PostDamein, on October 30, 2015 - 06:07 PM, said:

Oh, and also all the download links bring me to an error stating
Sorry, I didn't check the attachment. You'll have to stick to the plugin version then using the Plugin System as described above. Unless someone else is willing to convert it to a script again, or someone still has the converted version and sees this thread.
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.

#6 User is offline   riffruff Icon

  • Newbie
  • PipPip
  • Group: Beta Testers
  • Posts: 19
  • Joined: August-15 09

Posted November 04, 2015 - 02:57 AM

Man whoever made this made the rookie mistakes I did when I first started making these scripts forever ago. Anyways, I converted it. This should work. I think. I was bored.

Script("Name") = "Team Randomizer"
Script("Author") = "Unknown"
Script("Major") = 1
Script("Minor") = 00
Script("Revision") = 1
Script("Description") = "Randomizes teams I think"

Public Const iSeconds = 30
Public Const iMaxPlayers = 6

Public bRegister, iPlayerCount, oDict

Sub Event_Load()
	Randomize
	bRegister = False
	iPlayerCount = 0
	CreateObj "LongTimer", "Register"
	Register.Interval = 30
	Register.Enabled = false
	'deprecated
	'TimerInterval "teamrand", "Register", 30
	Set oDict = CreateObject("Scripting.Dictionary")
End Sub

Sub Event_UserTalk(Username, Flags, Message, Ping)
	If LCase(Left(Message, 7)) = BotVars.Trigger & "league" And bRegister = False Then
		sAccess = GetDBEntry(Username).Flags
		If sAccess = "MLS" OR sAccess = "MLSX" Then
			AddQ "4-6 Players Required. Randomizing partners and players who must sit in " & iSeconds & " seconds. Type " & BotVars.Trigger & "agree to register for this game."
			bRegister = True
			iPlayerCount = 0
			Register.Enabled = true
			'deprecated
			'TimerEnabled "teamrand", "Register", True
		Else
			fakeCommand = ""
		End If
	End If
	If LCase(Left(Message, 6)) = BotVars.Trigger & "agree" Then
		sAccess = GetDBEntry(Username).Flags
		If sAccess = "MLS" OR sAccess = "MLSX" Then
			If bRegister = True Then
				If iPlayerCount = iMaxPlayers Then
					AddQ iMaxPlayers & " players are already registered."
				Else
					If oDict.Exists(Username) Then
						AddQ Username & " is already registered."
					Else
						AddQ "Added " & Username & " to game."
						iPlayerCount = iPlayerCount + 1
						oDict.Add Username, "Player" & iPlayerCount
					End If
				End If
			End If
		End If
	End If
End Sub



Sub Register_Timer()
	Dim aPlayers(12)
	bRegister = False
	Register.Enabled = false
	'deprecated
	'TimerEnabled "teamrand", "Register", False
	AddQ "" & iPlayerCount & " players have signed up."
	If iPlayerCount < 4 Then
		AddQ "Not enough players registered. Please try again."
		oDict.RemoveAll
		Exit Sub
	End If

	AddQ "Randomizing teams now..."

	'// Populate Array based on dictionary
	X = 0
	For Each Username In oDict.Keys
		X = X + 1
		aPlayers(X) = Username
	Next

	'// Swap random elements of the array to shuffle the players
	For X = 1 to 500
		iA = RanNum(1,iPlayerCount)
		iB = RanNum(1,iPlayerCount)
		sA = aPlayers(iA)
		sB = aPlayers(iB)
		aPlayers(iA) = sB
		aPlayers(iB) = sA
	Next

	If iPlayerCount = 4 Then
		sTeam1 = ""
		sTeam2 = ""
		For X = 1 to 2
			sTeam1 = sTeam1 & aPlayers(X) & " || "
		Next
		For X = (Int(iPlayerCount/2) + 1) to 4
			sTeam2 = sTeam2 & aPlayers(X) & " || "
		Next


		AddQ "Xtreme HOT: || " & sTeam1
		AddQ "Xtreme COLD: || " & sTeam2

		oDict.RemoveAll
	End If

	If iPlayerCount = 5 Then
		sTeam1 = ""
		sTeam2 = ""
		sTeam3 = ""
		For X = 1 to 2
			sTeam1 = sTeam1 & aPlayers(X) & " || "
		Next
		For X = (Int(iPlayerCount/2) + 1) to 4
			sTeam2 = sTeam2 & aPlayers(X) & " || "
		Next
		For X = (Int(iPlayerCount/2) + 3) to iPlayerCount
			sTeam3 = sTeam3 & aPlayers(X) & " "
		Next


		AddQ "Xtreme HOT: || " & sTeam1
		AddQ "Xtreme COLD: || " & sTeam2
		AddQ "Players sitting out: " & sTeam3

		oDict.RemoveAll
	End If

	If iPlayerCount = 6 Then
		sTeam1 = ""
		sTeam2 = ""
		sTeam3 = ""
		For X = 1 to 2
			sTeam1 = sTeam1 & aPlayers(X) & " || "
		Next
		For X = (Int(iPlayerCount/2) + 1) to 5
			sTeam2 = sTeam2 & aPlayers(X) & " || "
		Next


		AddQ "Xtreme HOT: || " & sTeam1
		AddQ "Xtreme COLD: || " & sTeam2
		AddQ "!! All other players must sit out !!"

		oDict.RemoveAll
	End If

End Sub

'// Used to get a random number between minimum and maximum.
Function RanNum(minimum, maximum)
	RanNum = Int(((maximum + 1) - (minimum)) * Rnd + (minimum))
End Function

This post has been edited by riffruff: November 04, 2015 - 02:58 AM


#7 User is offline   PhiX Icon

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

Posted November 07, 2015 - 09:02 AM

W..Wel..Welcome back, riffruff! :o

View Postriffruff, on November 04, 2015 - 03:57 AM, said:

Man whoever made this made the rookie mistakes I did when I first started making these scripts forever ago.
From the original plugin:
'teamrand
'1.331
'&Team Randomizer:SoCxFiftyToo
'&pickteams
'&
'&Type "/me" or "/emote" to register yourself while teams are being picked

It was probably one of the first plugins added to the Plugin System. :P
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.

#8 User is offline   riffruff Icon

  • Newbie
  • PipPip
  • Group: Beta Testers
  • Posts: 19
  • Joined: August-15 09

Posted November 07, 2015 - 01:36 PM

Probably was -- but looking at the original, 52 used different commands. Whoever "stole" this changed the commands but never changed the search length for commands. 52 was too good to make mistakes like this :)

Page 1 of 1
  • 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