Author Topic: Simulate mouse click  (Read 4674 times)

Code to do /title. And no, i don't mean /activatestuff


Like shooting weapons for example. Sorry i wasn't specific, it's hard to type on a phone

Client sided:
mouseFire(1); (you probably already knew that one)

Server sided:
%player.getDataBlock().onTrigger(%player, 0, 1);

If you really want to simulate it exactly, you can call the function again shortly after, but with the last argument as 0.

Thanks, the latter was more or less what i was looking for. I'll fill in the gaps

Server sided:
%player.getDataBlock().onTrigger(%player, 0, 1);

Surely that wouldn't do anything engine leveled, such as firing weapons?

Surely that wouldn't do anything engine leveled, such as firing weapons?
it should activate trigger slot 0

i would imagine that those kinds of features are contained within that functionality

it should activate trigger slot 0

But onTrigger is called when the trigger is changed, it isn't the function to set the trigger down. It would call all add-ons which package onTrigger, but engine related stuff would be unaffected.

Idk, if it works then maybe I don't understand it as much as I thought I did..

Try %player.setImageTrigger(0,%val)
I'm actually not entirely sure if this exists for players, but I know it exists for bots

Try %player.setImageTrigger(0,%val)
I'm actually not entirely sure if this exists for players, but I know it exists for bots

It exists for all players (and bots, since they're players), but the controlling client's Move packets will overwrite the trigger your script sets.

Try %player.setImageTrigger(0,%val)
I'm actually not entirely sure if this exists for players, but I know it exists for bots
Tested it. It does fire the player's weapon.

But onTrigger is called when the trigger is changed, it isn't the function to set the trigger down. It would call all add-ons which package onTrigger, but engine related stuff would be unaffected.

Idk, if it works then maybe I don't understand it as much as I thought I did..
rite i was thinkin backwards

i knew i remembered something that actually triggered the trigger oops

So from what i understand,
You can use
%player.setImageTrigger(0,%val)
But move packets may make that appear choppy.
If so, is there a way to make it seamless?

So from what i understand,
You can useBut move packets may make that appear choppy.
If so, is there a way to make it seamless?
What'll happen is you call the method, setting the trigger to 1, but then it's immediately set back to 0.
If you just want a quick click to fire a single shot, that'll work fine, but if you want to do anything more, such as sustained fire, or a weapon with any charge time, that won't work.

What exactly are you trying to do?

Okay, that clears it up. I'll make it work. Thank you all for your help