Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-24-2007, 03:31 AM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
binocular action

PHP Code:
function scope()
{
//scope function - triggered through onkeypressed
client.freezetime = -1;
this.xmod playerx;
this.ymod playery;
this.scopeon true;

onTimeout();
}

function 
onTimeout()
{
if (
this.scopeon) { setfocus(this.xmod,this.ymod); player.chat format("x-%d,y-%d",this.xmod,this.ymod); }

setTimer(.05);
}

function 
unscope()
{
this.scopeon false;
client.freezetime 0;
resetfocus();
setTimer(0);
}
function 
onKeyPressed(keycodekeyname)
{
 switch (
keyname)
 {
  
//scope xy modifiers
  
case "i"this.ymod += 1; break;
  case 
"j"this.ymod -= 1; break;
  case 
"k"this.xmod -= 1; break;
  case 
"l"this.xmod += 1; break;

  case 
"f"scope(); break;
  case 
"g"unscope(); break;
 }

What this is supposed to do, is to act like binoculars - the onkeypressed call giving the respective keys control over the view, by increasing xmod or ymod (which the setfocus is supposed to be derived from in the first place) when pressed. However, it's not working. To my knowledge, onkeypressed is called whenever the key is pressed, so there's really no excuse for it not to be working - as far as my logic chain goes.

Assistance here would be lovely. I honestly can't figure out why this isn't working, and I'm sure some of you scriptgods would love the opportunity to make me look bad.

Actually no, I just made myself look bad. This works, but not when you're fullscreened because the focus movement is so minimal. Begin laughing at me please. However, I could still use some assistance if you see anything you think should be changed.

-whimper-

EDIT: however, it does seem to have a 2x2 level limitation on a gmap. Is there any way to extend this range, or is this an engine limitation?
__________________

I hope for nothing. I fear nothing. I am free.
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:43 PM.


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