elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Security Series.XSS. [Cross Site Scripting]


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  LUA SCRIPT - BOTONES CON DOBLE FUNCIÓN
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: LUA SCRIPT - BOTONES CON DOBLE FUNCIÓN  (Leído 4,128 veces)
CADIAR

Desconectado Desconectado

Mensajes: 1


Ver Perfil
LUA SCRIPT - BOTONES CON DOBLE FUNCIÓN
« en: 17 Marzo 2014, 18:34 pm »

Hola expertos en scripting.

Les explico, tengo speedpad Logitech G13, lo tengo configurado con macros para programas como autocad, revit y 3D max. Ahora quería intentar sacarle mas provecho configurándolo con Lua Scripting, pero me supera por mucho, no se ni como poner las macros en el script.

Lo que intento hacer con Lua es darle una doble función a los botones de modo que al presionar y soltar el botón se ejecute una macros, pero si se mantiene presionado por unos segundos más y se suelte se ejecute una macros distinta.

De antemano muchas gracias.



« Última modificación: 29 Marzo 2014, 15:42 pm por Eleкtro » En línea

Eleкtro
Ex-Staff
*
Desconectado Desconectado

Mensajes: 9.788



Ver Perfil
Re: LUA SCRIPT - BOTONES CON DOBLE FUNCIÓN
« Respuesta #1 en: 29 Marzo 2014, 15:42 pm »

@CADIAR, eliminé tu mensaje original por error, te envié un MP con el post, si lo vuelves a postear elimino mi post para no crear confusiones.

Porfavor, lee las normas:
1. Los códigos tienen que ir con su etiqueta Geshi, usa el botón para insertar código.





( El autor del siguiente mensaje es @CADIAR, no yo. )

Actualizando...

Conseguí un script que debería hacer lo que quiero, darle dos funciones a los botones según el tiempo que se mantengan presionados, pero me de el siguiente error cuando lo ejecuto:

E:\Logitech Scripts\llProject\llProject.lua:24: chunk has too many syntax levels

este es el script en cuestión:

Código
  1.    -- llProject End -->
  2.    ll=ll or {}; ll.SETUP = { Folder = [[E:\Logitech Scripts\llProject\]] }
  3.    dofile(ll.SETUP.Folder .. [[llProject.lua]])
  4.    -- llProject End -->
  5.  
  6.    -- ll.devMode = dm_TEST
  7.  
  8.    function _onActivation()
  9.    --
  10.    -- ADD ANY START UP ROUTINES HERE
  11.    --
  12.    ll.mouse.map[0] = {
  13.    }
  14.  
  15.    ll.lhc.map[1] = {
  16.    G1 = { fn_ClickHold, "a", 30, "b", 1000 },
  17.    G2 = { fn_ClickHold, { "lctrl", "c" }, 30, { "lshift", "d"}, 1000 },
  18.    }
  19.  
  20.    end
  21.  
  22.    ClickHoldInfo = {}  
  23.    function fn_ClickHold( ClickTableOrKey, ClickDelay, HoldTableOrKey, HoldDelay )
  24.    local key = ll.Event.Mode .. "|" .. ll.Event.Key .. "|" .. ll.Event.Family
  25.  
  26.    if ll.Event.Pressed then
  27.    ClickHoldInfo[key] = { timestamp = GetRunningTime(), held = false }
  28.    elseif ll.Event.Down then
  29.    if not ClickHoldInfo[key].held and GetRunningTime() - ClickHoldInfo[key].timestamp >= HoldDelay then
  30.    Press( HoldTableOrKey, ClickDelay )
  31.    ClickHoldInfo[key].held = true
  32.    end
  33.    elseif ll.Event.Released then
  34.    if GetRunningTime() - ClickHoldInfo[key].timestamp < HoldDelay then
  35.    PressAndRelease( ClickTableOrKey, ClickDelay )
  36.    else
  37.    Release( HoldTableOrKey, ClickDelay )
  38.    end
  39.    ClickHoldInfo[key] = nil
  40.    end
  41.    end
  42.  
  43.    function Press( TableOrKey )
  44.    local key, table
  45.  
  46.    if type(TableOrKey) == "table" then
  47.    table = TableOrKey
  48.    elseif type(TableOrKey) == "string" then
  49.    key = TableOrKey
  50.    else
  51.    return
  52.    end
  53.  
  54.    if key then
  55.    ll.Press(key)
  56.    else
  57.    for i, v in ipairs(table) do
  58.    ll.Press(v)
  59.    end
  60.    end
  61.    end
  62.  
  63.    function Release( TableOrKey )
  64.    local key, table
  65.  
  66.    if type(TableOrKey) == "table" then
  67.    table = TableOrKey
  68.    elseif type(TableOrKey) == "string" then
  69.    key = TableOrKey
  70.    else
  71.    return
  72.    end
  73.  
  74.    if key then
  75.    ll.Press(key)
  76.    else
  77.    for i, v in ipairs(table) do
  78.    ll.Release(v)
  79.    end
  80.    end
  81.    end
  82.  
  83.    function PressAndRelease( TableOrKey, delay )
  84.    local key, table
  85.    local delay = delay or 0
  86.  
  87.    if type(TableOrKey) == "table" then
  88.    table = TableOrKey
  89.    elseif type(TableOrKey) == "string" then
  90.    key = TableOrKey
  91.    else
  92.    return
  93.    end
  94.  
  95.    if key then
  96.    ll.Press(key)
  97.    Sleep(delay)
  98.    ll.Release(key)
  99.    else
  100.    for i, v in ipairs(table) do
  101.    ll.Press(v)
  102.    end
  103.    Sleep(delay)
  104.    for i, v in ipairs(table) do
  105.    ll.Release(v)
  106.    end
  107.    end
  108.    end


« Última modificación: 29 Marzo 2014, 15:46 pm por Eleкtro » En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
funcion mostrar lista doble lenguaje c
Programación C/C++
spectrumni 2 3,631 Último mensaje 26 Enero 2012, 23:39 pm
por spectrumni
Iluminación de botones con alguna función
Desarrollo Web
rolomo 0 1,352 Último mensaje 14 Marzo 2012, 00:31 am
por rolomo
Duda con doble pantalla y script
Dudas Generales
Mcaafe 1 1,966 Último mensaje 12 Octubre 2017, 18:27 pm
por engel lex
Quiero un Script en Lua para Hexchat
Scripting
Herchi 0 2,207 Último mensaje 27 Febrero 2021, 16:07 pm
por Herchi
¿Que es LUA?
Dudas Generales
Mudereded401 3 3,726 Último mensaje 28 Febrero 2021, 15:11 pm
por BloodSharp
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines