Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-21-2011, 09:01 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Line drawing tool

Published by request. Draws lines using Chompy's and Sales' DrawLine() function. Hold ctrl and drag yer mouse through Graal, wee~

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.draw false;
  
this.ox nil;
  
this.oy nil;
  
this.iIndex 0;
}

// erase drawn lines
function onEraseLines()
  
hideImgs(0199);

// mouse stuff
function GraalControl.onMouseDown(kmod) {
  if (
kmod in |48|) { // ctrl
    
this.draw true;
    
this.ox mousex;
    
this.oy mousey;
    
    
cancelEvents("EraseLines");
  }
}

function 
GraalControl.onMouseUp() {
  if (!
this.draw)
    return;
  
  
this.draw false;
  
cancelEvents("EraseLines");
  
scheduleEvent(3"EraseLines"nil);
}

function 
GraalControl.onMouseDragged() {
  if (!
this.draw)
    return;
  
  
temp.dx abs(this.ox mousex);
  
temp.dy abs(this.oy mousey);
  
temp.d  = (temp.dx temp.dy 2) ^ 0.5;
  if (
temp.0.1) {
    
temp.this.iIndex;
    
temp.0.5;
    
    
DrawLine(temp.ithis.oxthis.oymousexmousey16);
    
changeImgColors(temp.i1111);
    
changeImgVis(temp.i3);
    
    
this.iIndex++;
    
this.iIndex %= 200;
    
    
this.ox mousex;
    
this.oy mousey;
  }
}


// draw-a-line - thanks Chompy & Sales
// http://forums.graalonline.com/forums/showthread.php?t=78427
function DrawLine(idxsxsytxtyw) {
  
= (== nil 16 w);
  
temp.ang getangle(tx sxty sy) + pi 2;
  
  
showPoly(idx,
    { 
sxsy,
      
txty,
      
tx cos(ang) * wty sin(ang) * w,
      
sx cos(ang) * wsy sin(ang) * w  });

__________________
Reply With Quote
  #2  
Old 02-22-2011, 03:02 AM
Soala Soala is offline
Ideas on Fire
Soala's Avatar
Join Date: Jun 2007
Location: In my head
Posts: 3,208
Soala is a jewel in the roughSoala is a jewel in the rough
Kewl stuff :O
Reply With Quote
  #3  
Old 02-22-2011, 04:28 PM
Toxen Toxen is offline
A Toxic Fellow
Join Date: Jan 2008
Location: Georgia
Posts: 36
Toxen is on a distinguished road
very cool. repp++
__________________
UN NAT.
Reply With Quote
  #4  
Old 02-22-2011, 07:40 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
on the other persons screen does it show random lines? not a full line
__________________
Reply With Quote
  #5  
Old 02-22-2011, 07:47 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by xAndrewx View Post
on the other persons screen does it show random lines? not a full line
That can happen if you're drawing "too fast", yea. Seems to be a synchronization problem though.
__________________
Reply With Quote
  #6  
Old 02-22-2011, 07:52 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Ahhh- dusty had the same problem :[

good job though =D
__________________
Reply With Quote
  #7  
Old 02-25-2011, 05:14 PM
Twaina Twaina is offline
Registered User
Join Date: Dec 2010
Posts: 59
Twaina has a little shameless behaviour in the past
Old
Reply With Quote
  #8  
Old 02-26-2011, 02:48 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Twaina View Post
Old
Duh.
__________________
Reply With Quote
  #9  
Old 02-26-2011, 05:06 PM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
Quote:
Originally Posted by Twaina View Post
Old
ur old
__________________
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 05:02 PM.


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