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 01-04-2010, 03:03 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Frames-Per-Second

A small script I wrote up yesterday after the idea was sparked by Downsider.
Alt+f toggles it on and off:
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.updatespeed .5;  // SPEED THAT THE FRAMERATE IS CHECKED, > 0.05
  
setTimer(0.05);
}

function 
onKeyPressed(keycode) {
  if (
keycode == 1094) {                // OPENS WITH ALT+F
    
player.showfps = !player.showfps;
    
this.oldtimevar2 timevar2 0.05// START CHECK A FRAME BEHIND
    
setTimer(0.05);
  }
}

function 
onTimeout() {
  if (!
player.showfps) {
    
hideimg(200);
    return;
  } 
  
temp.framediff = (@timevar2-this.oldtimevar2).substring(0,5)/this.updatespeed;
  
temp.framerate int((1/framediff)*20+.5);
  
// FRAME RATE CAN NOT EXCEED 20 OR HIT 0
  
if (framerate 20 || framerate == 0framerate 20;
  
with (findimg(200)) {
    
GUIContainer.width-150;
    
GUIContainer.height-75;
    
font $pref::graal::defaultfontname;
    
zoom $pref::graal::defaultfontsize/24;
    
layer 4;
    
textshadow true;
    
text "f: " framerate;
  }
  
this.oldtimevar2 timevar2;
  
setTimer(this.updatespeed);


And in a level with 1024 images being displayed, running at a low fps:
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 08:04 AM.


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