Jump to content

Join our Discord

Talk to other users and have a great time
Discord Server

Welcome to our Community

Click here to get your Exiled Bot license
Donation Store
Sign in to follow this  
InfiniteMonkeys

[AutoIt Script] Tradespam

Recommended Posts

I made a program that can cycle through trade channels and say things/link items, it's not very user friendly at the moment but I figured I'd share it so people can try it out. Maybe you can sell some loot while waiting for the bot to update :)

Setup:

1) Download and install the latest version of AutoIt from here.

2) Download the script here, or copy and paste the spoilered code below into a blank .au3 file and save it.

$current_channel = 0 ;channel we're on at the moment
$max_channel = 10 ;highest channel the bot will spam
$set = 0 ;are hotkeys set or unset?
$start_text = "" ;text that comes before the trade message, leading $ and trailing space added automatically
$end_text = "" ;text that comes after the trade message, leading space added automatically
Global $sale_items[10][3] ;array of items for sale, 0 = x position, 1 = y position, 2 = text after item (eg price)
$current_items = 0 ;number of items currently in the above array

HotKeySet("`","Toggle")
Toggle()

Func NextTradeChannel()
   $current_channel += 1
   Sleep(200)
   Send("{ENTER}")
   Sleep(200)
   Send("/trade ")
   Sleep(200)
   Send($current_channel)
   Sleep(200)
   Send("{ENTER}")
   Sleep(200)
EndFunc

Func LastTradeChannel()
   $current_channel -= 1
   If $current_channel < 1 Then
	  $current_channel = 1
   EndIf
   Sleep(200)
   Send("{ENTER}")
   Sleep(200)
   Send("/trade ")
   Sleep(200)
   Send($current_channel)
   Sleep(200)
   Send("{ENTER}")
   Sleep(200)
EndFunc

Func TradeChannelOne()
   $current_channel = 1
   Sleep(200)
   Send("{ENTER}")
   Sleep(200)
   Send("/trade 1")
   Sleep(200)
   Send("{ENTER}")
   Sleep(200)
EndFunc

Func AdvertMessage()
   If $start_text == "" And $end_text == "" Then
	  SetText()
	  Return
   EndIf
   Send("{ENTER}")
   Send($start_text)
   For $i = 0 to $current_items - 1
	  Sleep(200)
	  Send("{CTRLDOWN}")
	  Send("{ALTDOWN}")
	  MouseClick("LEFT",$sale_items[$i][0],$sale_items[$i][1])
	  Send("{CTRLUP}")
	  Send("{ALTUP}")
	  Send($sale_items[$i][2])
   Next
   Sleep(200)
   Send($end_text)
   Sleep(200)
   Send("{ENTER}")
   Sleep(200)
EndFunc

Func BuyMessage($text)
   If Not $text Then
	  Return
   EndIf
   Send("{ENTER}")
   Send($text)
   Sleep(200)
   Send("{ENTER}")
   Sleep(200)
EndFunc

Func SetText()
   Toggle() ;so we can input text properly
   $start_text = "$" & InputBox("Tradespam","Message start text:","Selling") & " "
   $end_text = " " & InputBox("Tradespam","Message end text:","pm me")
   Toggle()
EndFunc

Func AddItem()
   If $current_items >= 9 Then
	  MsgBox(0,"Tradespam","Maximum number of items reached. Press Alt+t to clear item list.")
	  Return
   EndIf
   $sale_items[$current_items][0] = MouseGetPos(0)
   $sale_items[$current_items][1] = MouseGetPos(1)
   Toggle() ;so we can input text properly
   $sale_items[$current_items][2] = " " & InputBox("Tradespam","Text after item:","1 chaos")
   Toggle()
   $current_items += 1
EndFunc

Func ClearItems()
   Global $sale_items[10][3]
   $current_items = 0
EndFunc

Func SpamSell()
   TradeChannelOne()
   AdvertMessage()
   For $i from 1 to $max_channel-1
	  NextTradeChannel()
	  AdvertMessage()
   Next
   TradeChannelOne()
EndFunc

Func SpamBuy()
   Toggle()
   Local $message = "$" & InputBox("Tradespam","Buy message:","Buying ")
   TradeChannelOne()
   BuyMessage($message)
   For $i from 1 to $max_channel-1
	  NextTradeChannel()
	  BuyMessage($message)
   Next
   TradeChannelOne()
   Toggle()
EndFunc

Func Toggle()
   If $set == 0 Then
	  HotKeySet("^t", "AddItem")
	  HotKeySet("+t", "SetText")
	  HotKeySet("!t", "ClearItems")
	  HotKeySet("{INS}", "AdvertMessage")
	  HotKeySet("+{INS}", "SpamSell")
	  HotKeySet("^{INS}", "SpamBuy")
	  $set = 1
   ElseIf $set == 1 Then
	  HotKeySet("^t")
	  HotKeySet("+t")
	  HotKeySet("!t")
	  HotKeySet("{INS}")
	  HotKeySet("+{INS}")
	  HotKeySet("^{INS}")
	  $set = 0
   EndIf
EndFunc

;bleh
While 1

   Sleep(1000)

WEnd

3) Run the .au3 file by double clicking it.

Controls:

` (the button above tab and left of 1): Toggle Controls

Use this to toggle the other hotkeys off and on, important because otherwise you'll keep triggering the script when you try to type.

Ctrl-t: Add Item

Hover the mouse over an item you want to sell, then press this and it'll be added to the list of items to advertise. You'll also be prompted to include a message which will be sent after the item, so you can set a price for example.

Shift-t: Set Text

This allows you to set the text to be sent before and after items have been linked, for example 'Selling' then 'pm me'. Spaces before and after are automatically added, as is the $ to send to the trade channel. If you don't set this, you'll be prompted to the first time you use the Send Message or Spam Sell commands.

Alt-t: Clear Items

This will clear the list of items for sale completely, requiring you to add anything for sale again using Ctrl-t.

Insert: Send Message

This will send the sale message you made with Add Item and Set Text to the trade channel you're currently in.

Ctrl-Insert: Spam Sell

This will loop through all the trade channels from 1 to 10 and post the same message as the 'Send Message' command above.

Shift-Insert: Spam Buy

Prompts you for a message, then says this message in all the trade channels from 1 to 10. Useful if you want to buy or trade for something.

I know the controls are pretty horrible but this was initially made just for me. I intend to make a GUI at some point but I have zero experience with GUIs so it may take some time or not happen.

To Do:

Allow individual removal of sale items rather than requiring all items to be removed and re-added.

Make a GUI rather than having a load of hotkeys.

Feel free to suggest additions/changes.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×
×
  • Create New...