View Single Post
  #4  
Old 04-22-2011, 02:22 AM
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
I think he's saying why parse data like that when you can just use multidim arrays? For example you have:
PHP Code:
effects = {
  
"100:cause:Bleed:3:auto:460:bleed",
  
"75:cause:Disea se:15:auto:15,120:spread_disease"

Which with a multidim array could be:
PHP Code:
effects = {
  {
100,"cause","Bleed",3,"auto",460,"bleed"},
  {
75,"cause","Disease",15,"auto","15,120","spread_disease"}

And you avoid needing to do all the extra parsing. Alternatively to cover the damage problem, you can do:

PHP Code:
effects = {
  {
100,"cause","Bleed",3,"auto",460,"bleed"},
  {
75,"cause","Disease",15,"auto",{15,120},"spread_disease"}

Then, when you start working with the damage check the variable type, if it's numeric apply regularly, if it's an array apply min-max. You can do:
PHP Code:
array.add({75,"cause","Disease",15,"auto",{15,120},"spread_disease"}); 
you know?
Reply With Quote