Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-25-2016, 05:05 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Clicky Thing

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(162true) && keydown2(164true)){
    
//This bool is used for when you click
    
this.on true;
    
with(findimg(22)){
      
image "gunderak_cursor.png";
      
mousex;
      
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";
      
temp.click[1] -2;
      
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) > 0temp.ct player.chat;
    if(
temp.ct 10temp.ct 20;
    
//Store click info in array
    
this.clicks.add({this.count,mousexmouseytemp.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.
Attached Images
 
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:41 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.