Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 05-01-2011, 12:18 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 papajchris View Post
Thanks that link had great examples, final question and i think i got this part understood.

Could you do this

PHP Code:
for player.colorsBodyParts.index(BodyParts)] = tokens[1]; 
instead of

PHP Code:
for (iBodyPartsplayer.colorsBodyParts.indexi)] = tokens[1]; 
No. It might help if I pick apart his example.

PHP Code:
for (iBodyParts) {
  
player.colors[BodyParts.index(i)] = tokens[1];

This is the example with braces added to clarify it.

I don't really like how he's doing that anyway. This is how I would have done it:

PHP Code:
for (temp.0BodyParts.size(); ++) {
  
player.colors[i] = tokens[1];

Basically, i is starting at zero and increasing until it reaches the number of body parts. For each body part, it sets that part's color to tokens[1].

I'm not really sure how to explain the problems with yours except that it's just not following the right format. If you've got more questions I can try to answer them.

Also check out Jer's post on arrays.
__________________
Reply With Quote
 

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 10:38 AM.


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