This is a quick one I wrote on Zone iPhone, it's just used to show other staff where your mouse is, e.g. if you wish to point to a specific tile or NPC etc etc.
PHP Code:
//#CLIENTSIDE
//Seconds for clicks to be visible
const clicktime = 3;
function onCreated(){
this.count = 1;
this.on = false;
onTimeout();
}
function onTimeout(){
//If Left Ctrl and Left Alt is down
if(keydown2(162, true) && keydown2(164, true)){
//This bool is used for when you click
this.on = true;
with(findimg(22)){
image = "gunderak_cursor.png";
x = mousex;
y = mousey;
alpha = 0.5;
}
}else{
if(this.on){
this.on = false;
hideimg(22);
}
}
//Loop through array of clicks
for(temp.click : this.clicks){
temp.click[3] -= 0.05;
with(findimg(temp.click[0])){
image = "g4_particle_x.png";
x = temp.click[1] -2;
y = temp.click[2] -2;
zoom = 0.3;
alpha = temp.click[3];
}
//If the click is too old, remove
if(temp.click[3] <= 0){
hideimg(temp.click[0]);
this.clicks.remove(temp.click);
}
}
settimer(0.05);
}
function GraalControl.onMouseDown(){
if(this.on){
//This is used as an index for the click images
this.count ++;
if(this.count > 200){
this.count = 0;
}
temp.ct = clicktime;
if(int(player.chat) > 0) temp.ct = player.chat;
if(temp.ct > 10) temp.ct = 20;
//Store click info in array
this.clicks.add({this.count,mousex, mousey, temp.ct});
}
}
The second ghosted mouse is the in game image.
Notes:
You may need to add the cursor image to the showimgsallowedimages option in server ops.
Usage:
Hold down Left Ctrl and Left Alt, other players and staff will be able to see your mouse and clicks while these keys are held down.
You can also set your player chat to a number < 20 to change the time clicks are visible.