Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-24-2011, 07:05 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Speed Sandals

Just another staff boot script, but with a difference that I hope the users will find quite pleasant. It has an image / text display in the top right corner of your screen that shows your speed. You can increase speed by pressing + and otherwise decrease it by pressing -. Here is the script.
PHP Code:
//#CLIENTSIDE
function onKeyPressed(codeKey) {
  if (
Key == "z") {
    
setTimer(0.05);
    if (
this.mode == 0) {
      
this.mode 1;
      
this.speed 1;
    } else {
      
this.mode 0;
    }
  }
  if (
Key == "=") {
    
this.speed this.speed 1;
  }
  if (
Key == "-") {
    
this.speed this.speed 1;
  }
}

function 
onTimeout() {
  if (
this.mode == 1) {
    
showingimage();
    for (
temp.key 0key 4key++) {
      if (
keydown(key)) {
        
player.+= (vecx(key) * this.speed);
        
player.+= (vecy(key) * this.speed);
      }
    }
  }
  if (
this.mode == 0) {
    
hidingimage();
  }
  
setTimer(0.05);
}

function 
ShowingImage() {
  
with(findimg(200)) {
    
image "wboots.png";
    
layer 4;
    
screenwidth 675;
    
screenheight 610;
  }
  
with(findimg(201)) {
    
text "Speed: " thiso.speed;
    
screenwidth 638;
    
screenheight 601;
    
zoom 0.7;
    
layer 4;
    
style "bi";
    
textshadow true;
    
font "Tempsitc";
  }
}

function 
HidingImage() {
  
hideimg(200);
  
hideimg(201);

Attached Images
 
__________________
Reply With Quote
  #2  
Old 09-24-2011, 07:15 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
If the boots are turned off you should stop the timeout, there's no reason to keep it running every 0.05 seconds (even if it's not doing anything except constantly hiding the images). You can also use hideimgs(200, 201) to hide a range of images.

Something like this:
PHP Code:
function onKeyPressed(temp.codetemp.key) {
  if (
temp.key == "z") {
    
this.on = ! this.on// better to use booleans instead of integers for clarity
    
    
if (this.on) {
      
this.ShowingImage();
      
this.trigger("timeOut"); // this.setTimer(0.05) or this.onTimeOut() is also acceptable
    
} else {
      
this.HidingImage();
      
this.setTimer(0);
    }
  } else if (
temp.key == "=") {
    
// etc
  
}

You might also want to only show the images once (when the boots are turned on), and redraw them only when the screen resizes. You can then do

PHP Code:
findImg(201).text "Speed: " this.speed
after changing the boot speed.
__________________
Reply With Quote
  #3  
Old 09-24-2011, 07:39 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
I tried using hideimgs(); but foolishly I was doing something like
PHP Code:
hideimgs(200 201); 
and was stumped at why it wasn't working LOL. Thanks for the help though.
__________________
Reply With Quote
  #4  
Old 09-25-2011, 05:41 PM
cbk1996 cbk1996 is offline
Banned
Join Date: Sep 2011
Location: Kentucky
Posts: 5
cbk1996 has a little shameless behaviour in the past
Send a message via AIM to cbk1996
I would definitely suggest stopping the timeout, but you could also use the return handle to retrieve the MD5 hash to stop it as well. Perhaps setTimer(0) would work as well? Who knows.
Reply With Quote
  #5  
Old 09-25-2011, 05:54 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
I am going to let you in on 3 little secrets, ok?

1) Your fake cbk is so sad it is unreal.
2) I bet you don't even now what MD5 is.
3) I want you to GTFO

Leave now or we will make you leave. (Or a MOD will ban you for impersonating another member)
__________________

Last edited by Emera; 09-25-2011 at 06:36 PM..
Reply With Quote
  #6  
Old 09-25-2011, 06:33 PM
Hezzy002 Hezzy002 is offline
Registered User
Join Date: Jul 2011
Posts: 247
Hezzy002 is a jewel in the roughHezzy002 is a jewel in the rough
Quote:
Originally Posted by Emera View Post
I am going to let you in on 3 little secrets, ok?

1) Your fake cbk is so sad it is unreal.
2) I bet you don't eve now what MD5 is.
3) I want you to GTFO
pwn'd!!
Reply With Quote
  #7  
Old 09-25-2011, 08:13 PM
cbk1996 cbk1996 is offline
Banned
Join Date: Sep 2011
Location: Kentucky
Posts: 5
cbk1996 has a little shameless behaviour in the past
Send a message via AIM to cbk1996
Quote:
Originally Posted by Emera View Post
I am going to let you in on 3 little secrets, ok?

1) Your fake cbk is so sad it is unreal.
2) I bet you don't even now what MD5 is.
3) I want you to GTFO

Leave now or we will make you leave. (Or a MOD will ban you for impersonating another member)
It seems like your script is returning NULL! Gah. Open up the tar ball and extract the encrypted HASH hexadecimal encryption to bypass the surmounted excess of memory.

That should do it. If it doesn't work, post your errorlog.txt into a forum post.
Reply With Quote
  #8  
Old 09-25-2011, 09:01 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by cbk1996 View Post
It seems like your script is returning NULL! Gah. Open up the tar ball and extract the encrypted HASH hexadecimal encryption to bypass the surmounted excess of memory.

That should do it. If it doesn't work, post your errorlog.txt into a forum post.
Now, I am getting sick to death of you. Post your crap on another site, we really don't want it. You impersonate a valued member of these forums, act like a tart, post spam and useless posts on other peoples threads and have the IQ of a 3 year old. Please, give it a rest.
__________________
Reply With Quote
  #9  
Old 09-25-2011, 10:39 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Quote:
Originally Posted by Emera View Post
I tried using hideimgs(); but foolishly I was doing something like
PHP Code:
hideimgs(200 201); 
Isn´t it
PHP Code:
hideimgs(200201); 
__________________
MEEP!
Reply With Quote
  #10  
Old 09-25-2011, 10:45 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Yes. I said I tried it. I figured it out ya know <3
__________________
Reply With Quote
Reply


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 03:35 AM.


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