Blue Eye Logo

Blue Eye Macro

Automation is freedom
It is currently Thu Jul 18, 2019 6:16 pm

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Is there a way to have BEM select from options in a script?
Thanked: 0 time(s)  Unread post Posted: Tue May 28, 2019 3:58 pm 
New User
New User



Joined: Tue May 28, 2019 5:22 am
Posts: 4
Been thanked: 0 time(s)
Has thanked: 3 time(s)
Contribution Points: 16
Hey again, still trying to figure some new stuff out lol.
So atm I am working on a logout macro that detects if a Direct message has been sent, selects the chat box, types out a message and then exits the game.
So far I have
Code:
 begin
     // Exit game if PM'ed
     if  Color.Pixel pattern can be located on screen("231,160,47,4,3,230,155,45,4,3,255,255,255,5,-4,230,157,46,3,-1,237,183,59,5,0,231,159,47,4,0,251,251,251,4,2,255,255,255,3,3,255,255,255", "10")
          begin
               Function.Execute("Exit")
          end
 end
function("Exit")
     begin
          Mouse.Click at pixel pattern("14,14,16,-2,-3,55,56,58,1,-3,55,55,58,3,-1,55,55,58,2,2,55,56,58,28,1,55,56,58,2,0,13,14,16,2,0,13,14,16,14,0,55,56,58,2,0,20,21,24,16,0,13,14,16,2,0,13,14,16,2,0,55,55,58,0,2,20,21,24,6,0,14,14,16", "10", "no", "Left")
          Function.Execute("Human Pause3")
          Keyboard.Type text("Sorry was just heading out ttyl")
          Macro.Pause("300")
          Keyboard.Press key("{<enter>}")
          Function.Execute("Human Pause3")
          Keyboard.Press key("{<esc>}")
          Function.Execute("Human Pause")
          Mouse.Click at coordinate("955", "630", "Left")
          Macro.Abort all macros()
     end
function



So far this works great with no issues.. But what I need to know is if there is a way for BEM to select from a group of options to use 1. Right now it will always write ("Sorry was just heading out ttyl"). So if the same person PM's me they will get the same exact message as last time.

Is there a way to set stuff like
1. Sorry was just heading out ttyl
2. G2g sorry
3. About to leave for work
and so on.

and then when
Code:
begin
     // Exit game if PM'ed
     if  Color.Pixel pattern can be located on screen("231,160,47,4,3,230,155,45,4,3,255,255,255,5,-4,230,157,46,3,-1,237,183,59,5,0,231,159,47,4,0,251,251,251,4,2,255,255,255,3,3,255,255,255", "10")
          begin
               Function.Execute("Exit")
          end
 end

Gets triggered it will select a random option?

Sorry if im not explaining this well.


Top
 Profile  
Reply with quote  
 Post subject: Re: Is there a way to have BEM select from options in a scri
Thanked: 1 time(s)  Unread post Posted: Tue May 28, 2019 4:32 pm 
Partner / License admin
Partner / License admin
User avatar



Joined: Sun Oct 10, 2010 5:16 pm
Posts: 1903
Location: USA
Been thanked: 412 time(s)
Has thanked: 33 time(s)
Contribution Points: 16583
Yea (more than one way to do it). You could either have a separate file with lines for what you want to say (for instances when they are either longer or you have a lot of them) or just write them out as separate functions. Then use a random number generator to pick either the function or line depending on what route you took. Like this:
Code:
 begin
     Variable.Set random number("x", "1", "3")
     Function.Execute("{x}")
 end

function("1")
     begin
          Window.Display message box("message one", "yes")
     end
function

function("2")
     begin
          Window.Display message box("message two", "yes")
     end
function

function("3")
     begin
          Window.Display message box("message three", "yes")
     end
function

...Of course replace "window.display" with your "type text" message

Other option is to use "read line" (viewtopic.php?f=163&t=330) if your pulling from a file. You also don't need to make it random either, you could go in order. To do that just use "increment variable" instead of choosing a random number. Additionally, you could add code so you don't get duplicates (if you go that route do a forum search for examples).

_________________
----------------------------------------Syrifina---------------------------------------------------
PM me for licenses and/or licensing information: Click Here
[Be sure to include and update your profile with your BE ID]

Forum Rules
Reminder of rules regarding Contribution points
Getting started in 1, 2, 3
Virtual Drivers; Manual Installers


Top
 Profile  
Reply with quote  
 Post subject: Re: Is there a way to have BEM select from options in a scri
Thanked: 0 time(s)  Unread post Posted: Tue May 28, 2019 4:35 pm 
New User
New User



Joined: Tue May 28, 2019 5:22 am
Posts: 4
Been thanked: 0 time(s)
Has thanked: 3 time(s)
Contribution Points: 16
Oh this is perfect, thanks a bunch.


Top
 Profile  
Reply with quote  
 Post subject: Re: Is there a way to have BEM select from options in a scri
Thanked: 1 time(s)  Unread post Posted: Tue May 28, 2019 5:02 pm 
Partner / License admin
Partner / License admin
User avatar



Joined: Sun Oct 10, 2010 5:16 pm
Posts: 1903
Location: USA
Been thanked: 412 time(s)
Has thanked: 33 time(s)
Contribution Points: 16583
The way above will add many lines to your macro, especially if you have a lot of responses. Here's an example of reading from a file:
Code:
 begin
     Variable.Set random number("x", "1", "4")
     File.Read line("C:\Users\Syrifina\Desktop\example.txt", "{x}", "result")
     Window.Display message box("{result}", "yes")
 end
Much shorter; you just need to create/save a file first.

You can copy/paste/run this one, just create a file and insert your path instead of the one I used and change the number of choices to the number of lines/responses in your file.

_________________
----------------------------------------Syrifina---------------------------------------------------
PM me for licenses and/or licensing information: Click Here
[Be sure to include and update your profile with your BE ID]

Forum Rules
Reminder of rules regarding Contribution points
Getting started in 1, 2, 3
Virtual Drivers; Manual Installers


Top
 Profile  
Reply with quote  
 Post subject: Re: Is there a way to have BEM select from options in a scri
Thanked: 0 time(s)  Unread post Posted: Thu May 30, 2019 7:54 am 
New User
New User



Joined: Tue May 28, 2019 5:22 am
Posts: 4
Been thanked: 0 time(s)
Has thanked: 3 time(s)
Contribution Points: 16
Syrifina wrote:
The way above will add many lines to your macro, especially if you have a lot of responses. Here's an example of reading from a file:
Code:
 begin
     Variable.Set random number("x", "1", "4")
     File.Read line("C:\Users\Syrifina\Desktop\example.txt", "{x}", "result")
     Window.Display message box("{result}", "yes")
 end
Much shorter; you just need to create/save a file first.

You can copy/paste/run this one, just create a file and insert your path instead of the one I used and change the number of choices to the number of lines/responses in your file.



It's beautiful , thanks for all the help and advice.
Code:
function("Exit")
     begin
          Mouse.Click at pixel pattern("14,14,16,-2,-3,55,56,58,1,-3,55,55,58,3,-1,55,55,58,2,2,55,56,58,28,1,55,56,58,2,0,13,14,16,2,0,13,14,16,14,0,55,56,58,2,0,20,21,24,16,0,13,14,16,2,0,13,14,16,2,0,55,55,58,0,2,20,21,24,6,0,14,14,16", "10", "no", "Left")
          Function.Execute("Human Pause3")
          Variable.Set random number("x", "1", "18")
          File.Read line("D:\Documents\BlueEye\p1pms.txt", "{x}", "result")
          Keyboard.Type text("{result}")
          Keyboard.Press key("{<enter>}")
          Function.Execute("Human Pause3")
          Keyboard.Press key("{<esc>}")
          Function.Execute("Human Pause")
          Mouse.Click at coordinate("955", "630", "Left")
          Macro.Abort all macros()
     end
function



Thats what I ended up with, so I didn't change much , just added your part. But now I will know for future macros I make thanks to you :D.


Top
 Profile  
Reply with quote  
 Post subject: Re: Is there a way to have BEM select from options in a scri
Thanked: 0 time(s)  Unread post Posted: Sun Jun 02, 2019 2:55 am 
Partner / License admin
Partner / License admin
User avatar



Joined: Sun Oct 10, 2010 5:16 pm
Posts: 1903
Location: USA
Been thanked: 412 time(s)
Has thanked: 33 time(s)
Contribution Points: 16583
No problem; glad you got it working!

_________________
----------------------------------------Syrifina---------------------------------------------------
PM me for licenses and/or licensing information: Click Here
[Be sure to include and update your profile with your BE ID]

Forum Rules
Reminder of rules regarding Contribution points
Getting started in 1, 2, 3
Virtual Drivers; Manual Installers


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


You cannot post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group