Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-30-2007, 03:56 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
Triggering weapons

Anyone know whats wrong with this?
PHP Code:
//#CLIENTSIDE
function onCreatedNULL )
{
  
setTimer0.05 );
}
function 
onTimeOutNULL )
{
  if ( 
keydown2getkeycode"d" ), false ) )
  {
    if ( 
this.kpress == false )
    {
      
doTriggerWeaponNULL );
    }
    
this.kpress true;
  }
  else
  {
    
this.kpress false;
  }
  
setTimer0.05 );
}
function 
doTriggerWeaponNULL )
{
  
temp.findWeaponplayer.weapons[selectedweapon].name );
  
temp.i.onWeaponFired();

GraalScript: Function Weapon Weapons/Basic Sword.onWeaponFired not found in script of Weapon -Player/Trigger

is the error I get in F2 log. Please help :C
__________________
Reply With Quote
  #2  
Old 04-30-2007, 03:58 AM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
Is onWeaponFired() public in the weapon NPC?
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #3  
Old 04-30-2007, 03:59 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
Weapons/Basic Sword
PHP Code:
join"functions_weapon" );
//#CLIENTSIDE
function onCreatedNULL )
{
  
this.item_type "weapon";
  
this.item_name "Basic Sword";
  
this.item_var "basicsword";
  
  
this.sword_damage 10;
  
this.sword_freezetime .5;
  
this.sword_gani_idle "idle";
  
this.sword_gani_walk "walk";
  
this.sword_gani_attack "sword";
  
this.sword_image "sword2.png";

in the class

PHP Code:
[...]
//#CLIENTSIDE
[...]
function 
onWeaponFiredNULL )
{
  
equipWeaponNULL );

__________________
Reply With Quote
  #4  
Old 04-30-2007, 04:02 AM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
change it to:

PHP Code:
public function onWeaponFiredNULL )
{
  
equipWeaponNULL );

Is there any reason for passing NULL to the function?
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #5  
Old 04-30-2007, 04:05 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Quote:
Originally Posted by JkWhoSaysNi View Post
Is there any reason for passing NULL to the function?
I was thinking the same.
Reply With Quote
  #6  
Old 04-30-2007, 04:26 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
Makes it look better
__________________
Reply With Quote
  #7  
Old 04-30-2007, 04:48 AM
Deadly_Killer Deadly_Killer is offline
Registered User
Join Date: Feb 2002
Posts: 227
Deadly_Killer is on a distinguished road
Quote:
Originally Posted by cbkbud View Post
Makes it look better
It looks retarded, to be perfectly honest with you.

It seems like a lot of useless space, and is a horrible habit if you plan to go into other languages such as C/C++/C# due to functions needing to take specific parameters.
__________________
- Zidane / Zidaya
Reply With Quote
  #8  
Old 04-30-2007, 04:57 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
Quote:
Originally Posted by Deadly_Killer View Post
It looks retarded, to be perfectly honest with you.

It seems like a lot of useless space, and is a horrible habit if you plan to go into other languages such as C/C++/C# due to functions needing to take specific parameters.
You sound retarded, to be perfectly honest with you.

Please read my post on Clean Coding: Common Sense, and you will find that everyone has their own scripting style, and that if it's okay with them, it works. I've already stated my mind on people who say that lines of code matter, and that space matters. You can't waste space because I can put as many of those as I want.

I can already script in C++, so get off of my ass.
__________________
Reply With Quote
  #9  
Old 04-30-2007, 05:02 AM
Deadly_Killer Deadly_Killer is offline
Registered User
Join Date: Feb 2002
Posts: 227
Deadly_Killer is on a distinguished road
Quote:
Originally Posted by cbkbud View Post
You sound retarded, to be perfectly honest with you.

Please read my post on Clean Coding: Common Sense, and you will find that everyone has their own scripting style, and that if it's okay with them, it works. I've already stated my mind on people who say that lines of code matter, and that space matters. You can't waste space because I can put as many of those as I want.

I can already script in C++, so get off of my ass.
1) C++ is not a 'script'.
2) I won't argue with you, it seems like a waste of time.
__________________
- Zidane / Zidaya
Reply With Quote
  #10  
Old 04-30-2007, 05:44 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by JkWhoSaysNi View Post
Is there any reason for passing NULL to the function?
Yeah, seriously..? The script looks retarded, it's inefficient, the spacing between... everything is very bad looking, you're putting things where they don't need to be, and in my opinion, that script is terrible. I have done some bad scripting in my day, but nothing amounts to the poor quality of that specific script.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #11  
Old 04-30-2007, 08:07 AM
ff7chocoboknight ff7chocoboknight is offline
Skyzer Zolderon
ff7chocoboknight's Avatar
Join Date: Dec 2006
Location: New Hampshire, United States
Posts: 725
ff7chocoboknight is a name known to allff7chocoboknight is a name known to allff7chocoboknight is a name known to allff7chocoboknight is a name known to all
Send a message via AIM to ff7chocoboknight Send a message via MSN to ff7chocoboknight
Ok When Did This Thread Have Anything To Do With Attacking Eachother About How Ppl Script? I Mean Really Ppl, Lets All Argue About The Way He Scripts Instead Of Helping Him!!
__________________
Reply With Quote
  #12  
Old 04-30-2007, 08:26 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
You need to use public function,
public function onWeaponFired
should fix it.

Nice code btw,
Reply With Quote
  #13  
Old 04-30-2007, 08:43 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
Don't bite me.

Do this:

weapon.trigger("WeaponFired", params );

This'll trigger onWeaponFired, but if it doesn't exist, it doesn't do anything.

Another is to make onWeaponFired a public function and doing:
weapon.onWeaponFired();
Reply With Quote
  #14  
Old 04-30-2007, 01:44 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
Quote:
Originally Posted by Tigairius View Post
Yeah, seriously..? The script looks retarded, it's inefficient, the spacing between... everything is very bad looking, you're putting things where they don't need to be, and in my opinion, that script is terrible. I have done some bad scripting in my day, but nothing amounts to the poor quality of that specific script.
Quote:
Originally Posted by cbk1994
Please read my post on Clean Coding: Common Sense, and you will find that everyone has their own scripting style, and that if it's okay with them, it works. I've already stated my mind on people who say that lines of code matter, and that space matters. You can't waste space because I can put as many of those as I want.
Thank you Novo and Chandler for being nice about respecting other people's code, and for the suggestions. The weapon.trigger is working perfectly.

Would a moderator please lock this topic, it has no more purpose and I don't want an even bigger arguement.
__________________
Reply With Quote
  #15  
Old 04-30-2007, 03:11 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
I agree the NULL may be a little useless and does get rather in the way in my opinion but I don't see his script as looking horribly structured o_o

He likes to space his stuff out alot... So?

Personnaly, when I get into immensly long scripts, styling is important yes but any script style (as long as it is still organized and consistant) mean nothing as the script just a big haze (Have to remember where certain functions are defined in the script and such)
__________________
Do it with a DON!
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 01:45 AM.


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