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
  #2  
Old 03-27-2011, 02:22 AM
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
Please indent your code if you're going to release it, and use PHP tags instead of QUOTE tags.

PHP Code:
//Scripted by McChucken
//#CLIENTSIDE
function onKeyPressed(num1codenum2)
{
  if (
code == "1") {
    
player.chat "update level";
  }
  
sleep 0.1;
  
player.chat "";

In addition, there are several errors with it. Since the sleep and the line that resets the player's chat aren't in the if block, they'll happen any time you press a key.

I've corrected the code and left comments:
PHP Code:
//Scripted by McChucken
//#CLIENTSIDE
function onKeyPressed(codekeyscancode) { // code is the first parameter, not the second
  
if (key == "1") {
    
player.chat "update level";
    
sleep(0.1); // use parentheses for parameters, you had GS1 before
    
player.chat "";
  }

Nice attempt, though. Trying is the best way to learn. Sorry if I come off as being an ass, I'm just trying to make sure you understand the mistakes so you'll become a better scripter.
__________________
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 01:20 PM.


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