Jump to content

Vehicle individuality >_>


Deddalt

Recommended Posts

for individuality just add an id attribute to the car's node so you can get the vehicle element directly by using getElementID

e.g:

<vehicle id="first" model="372" posX="0" posY="0" posZ="10" /> 
<vehicle id="2" model="372" posX="0" posY="3" posZ="10" /> 

ID="1", ID="2" etc is most recommended by me.

And when all of your vehicles have numeric ID's, you can easily loop through them with getElementByID and destroy them by command. Making them appear again is another story... But... Ehm... Store them in tables perhaps..?

Link to comment

Numbers are easier, you can make a table with all the number vehicles and they're easy to loop. You can do a for or a while loop that constantly reads out 1 ID higher, instead of that you have to type words.

So words are more limited, a lot more vehicles are supported by numbers or words+numbers.

Link to comment

ID's as strings are pretty handy because they can be more descriptive (as in Mr. Hankey's examples) and they're just as easy to loop through:

  
for index,value in pairs({["apples"] = 50,["pears"] = 99}) do 
    outputChatBox(index .. " are " .. value .. "p guv'ner.") 
end 
  

Link to comment
ID's as strings are pretty handy because they can be more descriptive (as in Mr. Hankey's examples) and they're just as easy to loop through:
  
for index,value in pairs({["apples"] = 50,["pears"] = 99}) do 
    outputChatBox(index .. " are " .. value .. "p guv'ner.") 
end 
  

I don't really see what's better with strings that tostring(number) or something... Oh well, do what's the best choise.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...