Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


need help creating and destroying a popup form

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Ludwig
Advanced Cheater
Reputation: 0

Joined: 10 Jan 2016
Posts: 68

PostPosted: Sat Mar 12, 2016 10:43 am    Post subject: need help creating and destroying a popup form Reply with quote

hi guys

im trting to create a popup form with some txt...almost like the showMessage() function...but, i dont need the user to click anything on the popup, instead i want the popup visible and available until the refresh of browser is detected, after which it is destroyed...

here is what i got so-far...

Code:
function RefresH()

refrsh_popup    = {}
refrsh_popup[1]  = createForm(true)
refrsh_popup[2]  = createPanel(refrsh_popup[1])

refrsh_popup[4]  = createLabel(refrsh_popup[2])
refrsh_popup.onClose = function (sender)  object_destroy(sender)  end;
setProperty(refrsh_popup[1] , "Position", "poScreenCenter")
setProperty(refrsh_popup[1] , "Color", "0xffffff")
setProperty(refrsh_popup[1] , "BorderIcons", "[biSystemMenu]")
setProperty(refrsh_popup[1] , "BiDiMode", "bdLeftToRight")
setProperty(refrsh_popup[2] , "BiDiMode", "bdLeftToRight")
setProperty(refrsh_popup[2] , "BiDiMode", "bdLeftToRight")
local FontHeight = getProperty(refrsh_popup[4] , "Font")
setProperty(FontHeight , "Style", "[fsBold]")

control_setSize(refrsh_popup[1], 385, 250)
x,y = control_getSize(refrsh_popup[1])
control_setSize(refrsh_popup[2], x,y)

control_setPosition(refrsh_popup[3], 303,219)
control_setPosition(refrsh_popup[4], 5,5)
control_setCaption(refrsh_popup[1],"Please refresh your browser to enable the hack")

control_setCaption(refrsh_popup[4],"...wait a few seconds before clicking ok...if pop up re-appears...dont refresh again \n ...just wait until game starts loading before clicking ok... \n PLEASE NOTE: HACK LOAD MIGHT TAKE A WHILE...IF BROWSER SHOWS FLASH CRASH...IGNORE!!!")


end


function HackData:ActivateHack(sender)

 
--openbrwsTimer = createTimer(nil,false)
--timer_setInterval(openbrwsTimer, 2000)
--timer_onTimer(openbrwsTimer,)
   RefresH()

   repeat

   if not(AOBScan("d0 30 27 63 0c 27 63 07"))
   then

       --openbrwsTimer.Enabled = true;
   end
   until AOBScan("d0 30 27 63 0c 27 63 07")

     form_hide(refrsh_popup[1])


rest of function



i tried implementing a timer

openbrwsTimer = createTimer(nil,false)
timer_setInterval(openbrwsTimer, 2000)
timer_onTimer(openbrwsTimer,RefresH())


but same result...it doesnt show the complete form at first only (refrsh_popup[1],"Please refresh your browser to enable the hack") shows
, and it doesnt kill the form once done...instead once done it continues withy the rest of the script and show the complete form...i would like it to auto close...
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sat Mar 12, 2016 10:57 am    Post subject: Reply with quote

Use parenthesis only when you want to call a function.
When passing the function as an argument, no parenthesis.
timer_onTimer(openbrwsTimer,RefresH)
Back to top
View user's profile Send private message
Ludwig
Advanced Cheater
Reputation: 0

Joined: 10 Jan 2016
Posts: 68

PostPosted: Sat Mar 12, 2016 12:45 pm    Post subject: Reply with quote

Zanzer wrote:
Use parenthesis only when you want to call a function.
When passing the function as an argument, no parenthesis.
timer_onTimer(openbrwsTimer,RefresH)


thnx for the advice...but thats not the main issue atm...


Code:
function RefresH()

hideAllCEWindows()

InformationText2="Please refresh your browser to enable the hack \n ...wait a few seconds before clicking ok...if pop up re-apears...dont refresh again \n ...just wait until game starts loading before clicking ok... \n PLEASE NOTE: HACK LOAD MIGHT TAKE A WHILE...IF BROWSER SHOWS FLASH CRASH...IGNORE!!!"




        f=createForm(true)
   f.top = 10000;
   setProperty(f , "BiDiMode", "bdLeftToRight");
   setProperty(f , "ShowInTaskBar", "stAlways");
   setProperty(f , "FormStyle", "fsSystemStayOnTop");
   setProperty(f  , "Position", "poScreenCenter");
   sleep(100);
   setProperty(f , "FormStyle", "fsNormal");
   f.color = 0x00FF00;
   f.onClose = function (sender) sender.hide(); object_destroy(f)
                        object_destroy(f2) end;
   f.Caption = "Refresh please"
   f.Width = 300;
   f.Height = 200;

        f2 = createLabel(f);
   f2.Caption = InformationText2;
   f2.Top = 50;
   f2.Left = 5;


end


function HackData:ActivateHack(sender)

      display=true
   repeat

   if not(AOBScan("d0 30 27 63 0c 27 63 07"))
   then
          if display then
               display = false
                RefresH()
      f.show()
      setProperty(f , "ShowInTaskBar", "stAlways")
      setProperty(f , "FormStyle", "fsSystemStayOnTop")
      sleep(100)
      setProperty(f , "FormStyle", "fsNormal")
      wincontrol_setFocus(f2)
            end
     
   end
    until AOBScan("d0 30 27 63 0c 27 63 07")

     form_hide(f)

     object_destroy(f)
     object_destroy(f2)
     --object_destroy(f[3])
     unhideMainCEwindow();



i moved away from the timer...for now...but the issue still stays the same...for some reason only the first part of the form apears...with its outside caption...the inside part on the panel doesnt apear...got the closing issue sorted

--edit...
wincontrol_setFocus(f2) i get the popup to apear corectly...but it gives an access violation error...
wincontrol_setFocus(f)..gives no error...but only the form and its caption part (f) apears...not the label part(f2)

if someone can pls hlp in the right direction...

thnx...Smile
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Mar 12, 2016 3:05 pm    Post subject: Reply with quote

Code:
function RefresH()

  local form,panel,label

  local text=[[
Please refresh your browser to enable the hack
 ...wait a few seconds before clicking ok...if pop up re-appears...dont refresh again
 ...just wait until game starts loading before clicking ok...
 PLEASE NOTE: HACK LOAD MIGHT TAKE A WHILE...IF BROWSER SHOWS FLASH CRASH...IGNORE!!!]]

  form = createForm(false)

  form.BorderIcons   = "[biSystemMenu]"
  form.ShowInTaskBar = "stAlways"
  form.FormStyle     = "fsSystemStayOnTop"
  form.Position      = "poScreenCenter"
  form.Caption = "Refresh pls"
  form.AutoSize = true
  form.onClose = function (sender) sender.hide(); return caFree end

  panel = createPanel(form)
  panel.BorderSpacing.Around = 15
  panel.AutoSize = true

  label = createLabel(panel)
  label.Caption = text
  label.BorderSpacing.Around = 10
  label.Font.Style = "[fsBold]"

  form.show()
end


RefresH()

_________________
Back to top
View user's profile Send private message MSN Messenger
Ludwig
Advanced Cheater
Reputation: 0

Joined: 10 Jan 2016
Posts: 68

PostPosted: Sat Mar 12, 2016 3:42 pm    Post subject: Reply with quote

mgr.inz.Player wrote:
Code:
function RefresH()

  local form,panel,label

  local text=[[
Please refresh your browser to enable the hack
 ...wait a few seconds before clicking ok...if pop up re-appears...dont refresh again
 ...just wait until game starts loading before clicking ok...
 PLEASE NOTE: HACK LOAD MIGHT TAKE A WHILE...IF BROWSER SHOWS FLASH CRASH...IGNORE!!!]]

  form = createForm(false)

  form.BorderIcons   = "[biSystemMenu]"
  form.ShowInTaskBar = "stAlways"
  form.FormStyle     = "fsSystemStayOnTop"
  form.Position      = "poScreenCenter"
  form.Caption = "Refresh pls"
  form.AutoSize = true
  form.onClose = function (sender) sender.hide(); return caFree end

  panel = createPanel(form)
  panel.BorderSpacing.Around = 15
  panel.AutoSize = true

  label = createLabel(panel)
  label.Caption = text
  label.BorderSpacing.Around = 10
  label.Font.Style = "[fsBold]"

  form.show()
end


RefresH()




ok...changing to locals...interesting...but...running your script as is...it works fine...but the moment i call it thru the function as in:

Code:
function RefresH()

  local form,panel,label

  local text=[[
Please refresh your browser to enable the hack
 ...wait a few seconds before clicking ok...if pop up re-appears...dont refresh again
 ...just wait until game starts loading before clicking ok...
 PLEASE NOTE: HACK LOAD MIGHT TAKE A WHILE...IF BROWSER SHOWS FLASH CRASH...IGNORE!!!]]

  form = createForm(false)

  form.BorderIcons   = "[biSystemMenu]"
  form.ShowInTaskBar = "stAlways"
  form.FormStyle     = "fsSystemStayOnTop"
  form.Position      = "poScreenCenter"
  form.Caption = "Refresh pls"
  form.AutoSize = true
  form.onClose = function (sender) sender.hide(); return caFree end

  panel = createPanel(form)
  panel.BorderSpacing.Around = 15
  panel.AutoSize = true

  label = createLabel(panel)
  label.Caption = text
  label.BorderSpacing.Around = 10
  label.Font.Style = "[fsBold]"

  form.show()
end




function HackData:ActivateHack(sender)

local display=true



   repeat

   if not(AOBScan("d0 30 27 63 0c 27 63 07"))
   then
          if display then
            display = false
             RefresH()
      end
   end
        sleep(100)
   until AOBScan("d0 30 27 63 0c 27 63 07")




it gives me just the form part with "refresh pls"...the rest is blank

thnx for your effort...Smile

edit...seem i only get the error on labels...i can create edit boxes,,,buttons and checkboxes with no prblem...just not a label on that form...:/
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Mar 12, 2016 4:44 pm    Post subject: Reply with quote

Code:
   repeat

     local res=AOBScan("d0 30 27 63 0c 27 63 07")
     if display and res==nil
     then
       display = false
       RefresH()
     end

     sleep(100)
     processMessages()

   until res~=nil

_________________
Back to top
View user's profile Send private message MSN Messenger
Ludwig
Advanced Cheater
Reputation: 0

Joined: 10 Jan 2016
Posts: 68

PostPosted: Sun Mar 13, 2016 5:07 pm    Post subject: Reply with quote

mgr.inz.Player wrote:
Code:
   repeat

     local res=AOBScan("d0 30 27 63 0c 27 63 07")
     if display and res==nil
     then
       display = false
       RefresH()
     end

     sleep(100)
     processMessages()

   until res~=nil


thnx... processMessages() brings the whole box with label out...but...it stops the rest of the trainer untill it is killed manualy by the user...i would like it to apear visible only whie the test is false after which it should b destroyed automatically...
object_destroy(form) removed it b4...but now doesnt, as it is waiting for the user...and so does the rest of the script...

openbrwsTimer = createTimer(nil,false)
timer_setInterval(openbrwsTimer, 2000)
timer_onTimer(openbrwsTimer, processMessages)
openbrwsTimer.Enabled = true;
also doesnt hlp...or im using it wrong...
i woyld like the rest of the script to execute while the popup shows...then close/destroy ut if the result is right...
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sun Mar 13, 2016 5:34 pm    Post subject: Reply with quote

Better post your CT file.

While doing Copy&Paste you and I can make more mistakes.

_________________
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites