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 


Lua no recoil script

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
balckice
How do I cheat?
Reputation: 0

Joined: 25 Jan 2017
Posts: 3

PostPosted: Wed Jan 25, 2017 10:42 am    Post subject: Lua no recoil script Reply with quote

Hello everybody,

i'm totally new to lua, but i wrote a little no recoil script to be executed with L-Bia (so you can run it on every pc or usb drive). I encountered a little problem when i want to run the script:

Error message:

l-bia: l-bia.lua:9: syntax error near 'mb1_pressed'

I don't find any syntax errors, so maybe you guys could help me.
My script:

EnablePrimaryMouseButtonEvents(true)
function OnEvent(event, arg)
if event == "MOUSE_BUTTON_PRESSED" and arg == 6 then --set flag for mb1
mb1_pressed = true
elseif event == "MOUSE_BUTTON_RELEASED" and arg == 6 then --set flag for mb1=false
mb1_pressed = false
end

If mb1_pressed then
if event == "MOUSE_BUTTON_PRESSED" and arg == 1 and then
repeat
MoveMouseRelative(3,0)
Sleep(1)
MoveMouseRelative(0,10)
Sleep(1)
MoveMouseRelative(-3,-10)
Sleep(1)
MoveMouseRelative(-3,0)
Sleep(1)
MoveMouseRelative(3,10)
Sleep(1)
MoveMouseRelative(0,-10)
Sleep(1)
until not IsMouseButtonPressed(1)
end

end


thank you in advance for your help
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Wed Jan 25, 2017 11:09 am    Post subject: Reply with quote

It seem there are --[[extra: and]] and --[[missing, to close scope of 'function']]
bye~
Code:

EnablePrimaryMouseButtonEvents(true)
function OnEvent(event, arg)
  if event == "MOUSE_BUTTON_PRESSED" and arg == 6 then --set flag for mb1
    mb1_pressed = true
  elseif event == "MOUSE_BUTTON_RELEASED" and arg == 6 then --set flag for mb1=false
    mb1_pressed = false
  end

  if mb1_pressed then
    if event == "MOUSE_BUTTON_PRESSED" and arg == 1 --[[extra: and]] then
      repeat
        MoveMouseRelative(3,0)
        Sleep(1)
        MoveMouseRelative(0,10)
        Sleep(1)
        MoveMouseRelative(-3,-10)
        Sleep(1)
        MoveMouseRelative(-3,0)
        Sleep(1)
        MoveMouseRelative(3,10)
        Sleep(1)
        MoveMouseRelative(0,-10)
        Sleep(1)
      until not IsMouseButtonPressed(1)
    end
  end
end--[[missing, to close scope of 'function']]

_________________
- Retarded.
Back to top
View user's profile Send private message
balckice
How do I cheat?
Reputation: 0

Joined: 25 Jan 2017
Posts: 3

PostPosted: Wed Jan 25, 2017 12:55 pm    Post subject: Reply with quote

hey thank you for your quick help, seems like this was part of the problem,i updated the script, but now i get another error:

l-bia: l-bia.lua:1:attempt to call global 'EnablePrimaryMouseButtonEvents' (a nil value)
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Wed Jan 25, 2017 4:27 pm    Post subject: Reply with quote

It means EnablePrimaryMouseButtonEvents is not ever defined.

It look like your script not like standard Lua builtin nor CE provided extension (if it is used in CE), and from google,
it seems related to lXXitech device?

They should has some external dependency (modules) that you have to load into your script first.

Usually it need a 'require' statement, like
Code:

require ( "norecoilmod" )


given that your external modules are properly installed, and compatible with CE environment.
eg.
1.if it has an extension *.dll that its bit-ness 64-bit/32-bit match CE's,
2.if its lua version match CE's, 5.1 for ce 6.4, and 5.3 for ce 6.5+
etc.

bye~

_________________
- Retarded.
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Wed Jan 25, 2017 5:42 pm    Post subject: Reply with quote

Seem like use Logitech Gaming Mouse lua script.
But not sure which one use for your script, because LGM have many type, example : #G300s, #G19, etc.

- Check which LGM module use for your script
- Need Logitech Script Manager to activating your script (something same as "require" and "dofile" in pure lua)
- or Googling for Logitech lua scripting

Regards
Back to top
View user's profile Send private message
balckice
How do I cheat?
Reputation: 0

Joined: 25 Jan 2017
Posts: 3

PostPosted: Thu Jan 26, 2017 1:41 am    Post subject: Reply with quote

i own a g500, but i want this to work with every mouse, compile it to a standalone exe
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25784
Location: The netherlands

PostPosted: Thu Jan 26, 2017 3:35 am    Post subject: Reply with quote

use isKeyPressed or a hotkey and mouse_event/setMousePos instead

and multiply tbe sleeps by 1000
and/or a timer/thread since this will freeze the ce gui for 10 seconds

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
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