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(keycode, keyname)
{
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?