Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #16  
Old 12-20-2012, 03:53 PM
BlueMelon BlueMelon is offline
asdfg
BlueMelon's Avatar
Join Date: Sep 2008
Posts: 1,481
BlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to behold
Quote:
Originally Posted by scriptless View Post
Then cbk's is more easily readable. However, I still prefer doing it the way you posted.
I wouldn't agree, the ternary operator is easy to read if you use it properly.

@Crow,
Yes consistency is also key.
__________________
http://i.imgur.com/OOJbW.jpg
Reply With Quote
  #17  
Old 12-20-2012, 04:49 PM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Quote:
Originally Posted by BlueMelon View Post
I wouldn't agree, the ternary operator is easy to read if you use it properly.

@Crow,
Yes consistency is also key.
Assumming someone who know's nothing about scripting, they probably have a better chance of understanding cbk's before yours.. I didn't even know about the ternary operator untill about 2 years ago, or 3.. I forget.. and I have been scripting for 10 years now..
Reply With Quote
  #18  
Old 12-20-2012, 05:10 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by scriptless View Post
Assumming someone who know's nothing about scripting, they probably have a better chance of understanding cbk's before yours.. I didn't even know about the ternary operator untill about 2 years ago, or 3.. I forget.. and I have been scripting for 10 years now..
Your snippet doesn't make any logical sense, though, so it's not any better. I hope you realize that.
__________________
Reply With Quote
  #19  
Old 12-20-2012, 05:17 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by Crow View Post
Your snippet doesn't make any logical sense, though, so it's not any better. I hope you realize that.
This.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #20  
Old 12-20-2012, 10:14 PM
BlueMelon BlueMelon is offline
asdfg
BlueMelon's Avatar
Join Date: Sep 2008
Posts: 1,481
BlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to behold
Quote:
Originally Posted by scriptless View Post
Assumming someone who know's nothing about scripting, they probably have a better chance of understanding cbk's before yours.. I didn't even know about the ternary operator untill about 2 years ago, or 3.. I forget.. and I have been scripting for 10 years now..
Are you serious? Do you know any other programming/scripting languages? The ternary operator is taught with all the basics of any language... -.-'
__________________
http://i.imgur.com/OOJbW.jpg
Reply With Quote
  #21  
Old 12-20-2012, 11:02 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
Quote:
Originally Posted by BlueMelon View Post
Are you serious? Do you know any other programming/scripting languages? The ternary operator is taught with all the basics of any language... -.-'
This is a thread attempting to help someone with something like random(). Ternary is just going to confuse them at this point.
Reply With Quote
  #22  
Old 12-22-2012, 09:12 PM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Quote:
Originally Posted by BlueMelon View Post
Are you serious? Do you know any other programming/scripting languages? The ternary operator is taught with all the basics of any language... -.-'
I never went to college to learn any languages. I started when I needed to learn a language to use to further my work with Reverse Engeneering Graal around the 2.x days. (Ending at 2.310). But I do however, know a little bit (enough to kinda follow along and figure stuff out) in Delphi/Pascal, C, C++, C#, and various web languages.

It would most likely confuse any new person who has yet to begin a class tho is what I was meaning. Someone that knows nothing yet would be more likely to read cbk's.

Quote:
Originally Posted by Crow View Post
Your snippet doesn't make any logical sense, though, so it's not any better. I hope you realize that.
True, tho it does work.
Reply With Quote
  #23  
Old 12-23-2012, 02:53 AM
BboyEatsbacon BboyEatsbacon is offline
The Bacon Man
BboyEatsbacon's Avatar
Join Date: Feb 2011
Location: United States
Posts: 60
BboyEatsbacon will become famous soon enough
Send a message via Skype™ to BboyEatsbacon
You all are making it so complex, but with GS2, you can tackle this problem simply.

Graal Script Code:
function onCreated() {
  
this.possibilities = { "5""10" };

  
drawRandomNumber();
}

function 
drawRandomNumber() {
  
this.number randomstring(this.possibilities);

While this is not good practice for other engines, GS2 supports inputting a string as an integer, so this script would work smoothly.
Reply With Quote
  #24  
Old 12-23-2012, 12:34 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by BboyEatsbacon View Post
You all are making it so complex, but with GS2, you can tackle this problem simply.

Graal Script Code:
function onCreated() {
  
this.possibilities = { "5""10" };

  
drawRandomNumber();
}

function 
drawRandomNumber() {
  
this.number randomstring(this.possibilities);

While this is not good practice for other engines, GS2 supports inputting a string as an integer, so this script would work smoothly.
randomString() is not a good option. It's been bugged for a long time, and sometimes results in a blank result. With sometimes, I really mean fairly often.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #25  
Old 12-23-2012, 03:43 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 xXziroXx View Post
randomString() is not a good option. It's been bugged for a long time, and sometimes results in a blank result. With sometimes, I really mean fairly often.
Stefan said he would fix it in Nov. 2011:

Quote:
Originally Posted by Admins View Post
Ok will fix that behaviour of randomstring(), it was originally not made for getting arrays as input.
Not sure if it was ever fixed or not though.
__________________

Last edited by cbk1994; 12-23-2012 at 06:34 PM..
Reply With Quote
  #26  
Old 12-23-2012, 05:52 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by cbk1994 View Post
Stefan said he would fix it on in Nov. 2011:



Not sure if it was ever fixed or not though.
It's not been fixed, I tried it a few days ago.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #27  
Old 12-24-2012, 04:22 AM
BboyEatsbacon BboyEatsbacon is offline
The Bacon Man
BboyEatsbacon's Avatar
Join Date: Feb 2011
Location: United States
Posts: 60
BboyEatsbacon will become famous soon enough
Send a message via Skype™ to BboyEatsbacon
Quote:
Originally Posted by xXziroXx View Post
randomString() is not a good option. It's been bugged for a long time, and sometimes results in a blank result. With sometimes, I really mean fairly often.
Ah okay.

It's always worked for me, my apologies.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 09:30 AM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (C) 1998-2008 Linux cyberjoueurs All Rights Reserved.