Jump to content

Variable must be of type "Object" error


Recommended Posts

I am working through a code for a MTGO Bot bit by bit to get it to work ( The code itself was initialy posted on here, saying people could use it so I hope its ok)

I am currently at this part in the code

Func GetPlayer() ;Get the player's Name
Dim $miDoc, $Doc
Dim $str
Dim $oWord
Dim $sArray[500]
Dim $count
Dim $miLayout

;take screenshot
    $sTargetImage = @DesktopDir & "\New Smartbot\Player_tgt.jpg"
    _ScreenCapture_Capture($sTargetImage, 37, 260, 291, 289, $fCursor = False);233

$miDoc = ObjCreate("MODI.Document")
$miDocView = ObjCreate("MiDocViewer.MiDocView")

$Viewer = GUICreate ( "Embedded MODI Viewer", 640, 580,(@DesktopWidth-640)/2, (@DesktopHeight-580)/2)
GUICtrlCreatePic ( $sTargetImage, 320, 290, 0, 0)
GUICtrlSetResizing ($Viewer, $GUI_DOCKAUTO)
GUISetBkColor(0xFFFFFF)
GUISetState ()
$MiDocView.Document = $miDoc
$MiDocView.SetScale (1, 1)
_ScreenCapture_Capture($sTargetImage, 250, 250, 750, 600, $fCursor = False)
GUISetState (@SW_HIDE)
$miDoc.Create(@DesktopDir & "\New Smartbot\Player_tgt.jpg")
$miDoc.Ocr($miLANG_ENGLISH, True, False)

$i = 0

For $oWord in $miDoc.Images(0).Layout.Words
    $str = $str & $oWord.text & @CrLf
        ConsoleWrite("FROM GETPLAYER: " & $oWord.text & @CrLf)
    $sArray [$i] = $oWord.text
    $i += 1
Next

return $sArray [0]
EndFunc

Currently the bot is failing at

GUISetBkColor(0xFFFFFF)

GUISetState ()

$MiDocView.Document = $miDoc <--------------HERE

$MiDocView.SetScale (1, 1)

_ScreenCapture_Capture($sTargetImage, 250, 250, 750, 600, $fCursor = False)

With this error

C:\XXXX\XXXXX\XXXXX\ (New).au3 (296) : ==> Variable must be of type "Object".:

$MiDocView.Document = $miDoc

$MiDocView^ ERROR

I am no expert at Autoit and i am just learning as i go but currently this problem has me stumped

Hope i provided enough info, if not i can provide more

Link to comment
Share on other sites

  • Moderators

Lasaqus,

Did you see the announcement at the top of the forum? If not you can read it here.

I do think you are going to have a lot of help. Why not try and do something more useful with AutoIt than botting a game? :mellow:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Lasaqus,

Did you see the announcement at the top of the forum? If not you can read it here.

I do think you are going to have a lot of help. Why not try and do something more useful with AutoIt than botting a game? :mellow:

M23

I did read that, since bots are allowed to run in MTGO i assumed that it would be ok to post this here.

I also have read alot of post on MTGO bots and it was also from the Autoit forum i came across the code.

Am i allowed to have the post or shall i delete it. ?

Link to comment
Share on other sites

  • Moderators

Lasaqus,

I have just quickly looked at the Terms for MTGO (a few minutes wasted from my life I will never recover :mellow: ) and I see:

"You agree not to engage in any of the following: (a) use any automated means, including, without limitation, agents, robots, scripts, or spiders"

So where do you get the idea that:

bots are allowed to run in MTGO

Like I said - why not do something useful with Autoit instead? :P

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Developers

According to the announcement you are allowed to post this. Someone needs to take a look back at the announcement himself.

Let me see whether I understand this correctly: You are seriously telling Melba23 to read the announcement?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Lasaqus,

I have just quickly looked at the Terms for MTGO (a few minutes wasted from my life I will never recover :mellow: ) and I see:

"You agree not to engage in any of the following: (a) use any automated means, including, without limitation, agents, robots, scripts, or spiders"

So where do you get the idea that:

Like I said - why not do something useful with Autoit instead? :P

M23

Becuase i play MTGO alot and there are umpteen bots running for automated trades, also the various posts within MTGO's own forums for bot programs and such

Link to comment
Share on other sites

  • Developers

Becuase i play MTGO alot and there are umpteen bots running for automated trades, also the various posts within MTGO's own forums for bot programs and such

Which part of it not being allowed here is difficult to understand?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I don't want to get into any arguement here.

I have read the terms of use and also the code of conduct and unable to find the link or information you provided.

My case is

http://www.wizards.com/Magic/TCG/Article.aspx?x=magic/magiconline/coc (Code of Conduct)

http://wizards.custhelp.com/cgi-bin/wizards.cfg/php/enduser/std_adp.php?p_faqid=1358 (Terms of Service)

Unless i haven't noticed there isn't anything stated with either ToC or CoC stating the non-use of bots

These topics also discuss MTGO Bots and none where closed

http://www.autoitscript.com/forum/index.php?showtopic=35496

http://www.autoitscript.com/forum/index.php?showtopic=75303

http://www.autoitscript.com/forum/index.php?showtopic=87084 (this is the post i got my code from to try and fix)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...