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
  #16  
Old 08-21-2003, 09:12 PM
Snakeandy7 Snakeandy7 is offline
"Member ID=2610"
Snakeandy7's Avatar
Join Date: Mar 2003
Posts: 987
Snakeandy7 is on a distinguished road
Lol, finally he got it, still chance for you zero.
Anywho you could of done
if (playerenters || timeout){
}
lol, Anywho
__________________
"Freedom is best I tell thee
of all things to be won
then never live within the bond
of slavery my son".


Reply With Quote
  #17  
Old 08-21-2003, 09:22 PM
marcoR marcoR is offline
Registered User
Join Date: Jul 2003
Posts: 1,349
marcoR is on a distinguished road
I knew how to make it work, I just didn't know how to do it propperly.
__________________
If this is your account, contact me.
- loriel
email, jabber: [email protected]
icq: 67530805
aim: lorielvictrix
Reply With Quote
  #18  
Old 08-21-2003, 09:37 PM
Snakeandy7 Snakeandy7 is offline
"Member ID=2610"
Snakeandy7's Avatar
Join Date: Mar 2003
Posts: 987
Snakeandy7 is on a distinguished road
Quote:
Originally posted by marcoR
I knew how to make it work, I just didn't know how to do it propperly.
You got there in the end
__________________
"Freedom is best I tell thee
of all things to be won
then never live within the bond
of slavery my son".


Reply With Quote
  #19  
Old 08-21-2003, 11:01 PM
Riot-Starter Riot-Starter is offline
Registered User
Join Date: Aug 2001
Location: Central Florida, USA
Posts: 79
Riot-Starter is on a distinguished road
Send a message via AIM to Riot-Starter
Just a side note:
playerscount includes NPCs when used clientside.
Reply With Quote
  #20  
Old 08-21-2003, 11:06 PM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
Quote:
Originally posted by Riot-Starter
Just a side note:
playerscount includes NPCs when used clientside.
only showcharacter ones I believe, unless that was changed
Reply With Quote
  #21  
Old 08-21-2003, 11:20 PM
Riot-Starter Riot-Starter is offline
Registered User
Join Date: Aug 2001
Location: Central Florida, USA
Posts: 79
Riot-Starter is on a distinguished road
Send a message via AIM to Riot-Starter
Quote:
Originally posted by Python523


only showcharacter ones I believe, unless that was changed
I think it is only showcharacters, I just remember problems with gralats causing spar room doors to stay closed.
Although there is an easy fix to determine whether it’s an NPC or player.
Reply With Quote
  #22  
Old 08-21-2003, 11:38 PM
Tseng Tseng is offline
Sublime
Tseng's Avatar
Join Date: Jan 2003
Location: California
Posts: 0
Tseng is on a distinguished road
Quote:
Originally posted by protagonist



It is neater. Read KSI-GS standards thread.
Neater? Subjective. I find it neater to have a balance of lines and lengths. You find it neater to have one check per line. When they are related (as they are in this case), I find it unnecessary to split it up. Perhaps I should paste the first line of the first if check in the hpfunctions subroutine on graal2001, and ask if those shouldn't be split up.

One line of two related checks (an event and a condition) and splitting them up one to each line is the same code - so you can't really argue efficiency or optimization, but only a stylistic choice.

(Additionally, the standards thread does not mention putting an event and a condition on separate lines.
__________________
Funny Things:
Quote:
Originally posted by Stefan
I didn't ban you, I only played a little bit with my RC.
-----

Last edited by Tseng; 08-21-2003 at 11:51 PM..
Reply With Quote
  #23  
Old 08-21-2003, 11:40 PM
marcoR marcoR is offline
Registered User
Join Date: Jul 2003
Posts: 1,349
marcoR is on a distinguished road
I'm not a script head, so.. these rules would not be worth remembering, nor practicing.
__________________
If this is your account, contact me.
- loriel
email, jabber: [email protected]
icq: 67530805
aim: lorielvictrix
Reply With Quote
  #24  
Old 08-22-2003, 12:51 PM
protagonist protagonist is offline
Banned
protagonist's Avatar
Join Date: May 2003
Location: CAW
Posts: 5,586
protagonist is on a distinguished road
Send a message via AIM to protagonist Send a message via MSN to protagonist
Quote:
Originally posted by Tseng


Neater? Subjective. I find it neater to have a balance of lines and lengths. You find it neater to have one check per line. When they are related (as they are in this case), I find it unnecessary to split it up. Perhaps I should paste the first line of the first if check in the hpfunctions subroutine on graal2001, and ask if those shouldn't be split up.

One line of two related checks (an event and a condition) and splitting them up one to each line is the same code - so you can't really argue efficiency or optimization, but only a stylistic choice.

(Additionally, the standards thread does not mention putting an event and a condition on separate lines.
I also find it more efficient to have one check per line in MOST cases. It adds flexibility to a script. You can add in additional commands and statements very easily as compared to having multiple checks in your if statement.
Reply With Quote
  #25  
Old 08-22-2003, 07:52 PM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
Quote:
Originally posted by Riot-Starter

I think it is only showcharacters, I just remember problems with gralats causing spar room doors to stay closed.
Although there is an easy fix to determine whether it’s an NPC or player.
Yep,also these new gralats are showcharacters =p
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
Reply With Quote
  #26  
Old 08-22-2003, 10:41 PM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
Quote:
Originally posted by protagonist


I also find it more efficient to have one check per line in MOST cases
that's not more efficient, it's just your style. dang, that word is getting thrown around to often nowadays
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #27  
Old 08-22-2003, 11:14 PM
KainDaMan KainDaMan is offline
Registered User
Join Date: Jul 2003
Location: Virginia,USA
Posts: 51
KainDaMan is on a distinguished road
Send a message via AIM to KainDaMan
you can solve the problem of it counting npc characters by doing a for statement that includes the playerscount and a check if players[i].id>=0; as -1 = npc character. then if it's true add to a variable. this, however, would require resetting the string every time the event is called. I would go right out and post the script, but I fear it is against the rules of the NPC Scripting Forums
__________________
---Kain Morbid
Reply With Quote
  #28  
Old 08-23-2003, 01:04 AM
Tseng Tseng is offline
Sublime
Tseng's Avatar
Join Date: Jan 2003
Location: California
Posts: 0
Tseng is on a distinguished road
Quote:
Originally posted by protagonist


I also find it more efficient to have one check per line in MOST cases. It adds flexibility to a script. You can add in additional commands and statements very easily as compared to having multiple checks in your if statement.
Um, the first 'check' is when the action is called, so that happens regardless. The second 'check', be it on another line or in the same if ( ) statement, will be executed regardless; efficiency is not something you can debate with this.

Very easily? I don't go around putting '&& otherflag==true' for every check I add, but it is arguably easier to type two ampersands than 'if ( ) { }'. That does not make it better, but you are incorrect in saying it's easier.
__________________
Funny Things:
Quote:
Originally posted by Stefan
I didn't ban you, I only played a little bit with my RC.
-----
Reply With Quote
  #29  
Old 08-23-2003, 01:18 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
It depends on Graal's inner workings. If you're using a literal compiler/interpreter that doesn't make a distinction between & and && then it's more efficient to split up the checks - if you combine them then it'll happily evaluate the whole condition without stopping to check if it's already invalidated itself.
__________________
Reply With Quote
  #30  
Old 08-23-2003, 03:46 AM
Tseng Tseng is offline
Sublime
Tseng's Avatar
Join Date: Jan 2003
Location: California
Posts: 0
Tseng is on a distinguished road
Quote:
Originally posted by Kaimetsu
It depends on Graal's inner workings. If you're using a literal compiler/interpreter that doesn't make a distinction between & and && then it's more efficient to split up the checks - if you combine them then it'll happily evaluate the whole condition without stopping to check if it's already invalidated itself.
Well, I think I said it before, but I am only talking about an:

if (event && flag=true) {

compared to:

if (event) {
if (flag==true) {

type situation - if the event occurs, how could it invalidate itself in either?

Or, are you talking about if the event doesn't occur at all? That's the only way I can think that it could be invalidated...
__________________
Funny Things:
Quote:
Originally posted by Stefan
I didn't ban you, I only played a little bit with my RC.
-----
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 05:10 PM.


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