the Rainbow Networks
+++eXy FFA
Map: q3tourney3
Players: 2 / 18
The golden pot › RAINBOW NETWORKS › Tech & Support › autotap
autotap
Something wrong with our servers or your system?
Post new topic   Reply to topic   Printer Friendly Page     Forum IndexTech & Support
View previous topic :: View next topic  
Author Message
jackthompson
Admin
Admin


Joined: Aug 15, 2007
Posts: 1302
Location: Here

PostPosted: Fri Jul 10, 2015 2:12 pm    Post subject: autotap Reply with quote

Small C program that simulates three lmb presses on one rmb press.

For weapons that lack burst.

You might want to tinker with
Code::
usleep (((rand () % 50) + 50) * 1000);
...and what buttons are used/simulated.

Code::
// gcc autotap.c -o autotap -std=gnu99
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <linux/input.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>


#define DEVICE "/dev/input/event6"


int
read_rmb (int fd)
{
  struct input_event press;
//  memset(&press, 0, sizeof (struct input_event));
  read(fd, &press, sizeof (struct input_event));
  if (press.type == EV_KEY && press.code == BTN_RIGHT)
    return 1;
  return 0;
}


int
write_lmb (int fd)
{
  struct input_event press, release;

  memset (&press, 0, sizeof (struct input_event));
  memset (&release, 0, sizeof (struct input_event));

  gettimeofday (&press.time, NULL);
  press.type = EV_KEY;
  press.code = BTN_MOUSE;
  press.value = 1;
  gettimeofday (&release.time, NULL);
  release.type = EV_KEY;
  release.code = BTN_MOUSE;
  release.value = 0;
  for (int i = 0; i < 3; i++)
    {
      write (fd, &press, sizeof (struct input_event));
      write (fd, &release, sizeof (struct input_event));
      usleep (((rand () % 50) + 50) * 1000);
    }
  return 0;
}


int
main (int argc, char **argv)
{
  int fd = open (DEVICE, O_RDWR);
  if (fd < 0)
    {
      printf("ERROR: open():%s\n", strerror(errno));
      return -1;
    }
  while (1)
    if (read_rmb (fd) == 1)
      write_lmb (fd);
  close (fd);
  return 0;
}
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic   Printer Friendly Page     Forum Index -> Tech & Support All times are GMT + 1 Hour
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


Welcome Anonymous


Membership:
Latest: Evilemerold
New Today: 0
New Yesterday: 0
Overall: 354

People Online:
Members: 0
Visitors: 18
Total: 18
Who Is Where:
 Visitors:
01: The golden pot
02: The golden pot
03: The golden pot
04: The golden pot
05: Rainbow Media
06: The golden pot
07: The golden pot
08: The golden pot
09: The golden pot
10: The golden pot
11: The golden pot
12: Home
13: Maps
14: Home
15: The golden pot
16: The golden pot
17: My Account
18: My Account

Staff Online:

No staff members are online!

The Rainbow Networks website is hosted by JockeTF and Soder on furver.se.

The Rainbow Networks
Interactive software released under GNU GPL, Code Credits, Privacy Policy
Azul theme and related images designed by Jamin