Good try
No need to hurry about reading my tutorial, though do let me know if you have questions or suggestions should end up reading it.
? means either 0 or 1 occurrence. I.e. either a single space, _underscore or -dash. Or no character at all. So the following for strings are all ok.
- <lock price>
- <lock_price>
- <lock-price>
- <lockprice>
\s is a whitespace character. Could be space, tabular, carriage return, new line. \s* means there can be any number of whitespace characters including 0. The following are all valid matches:
- <added_price 123>
- <added-price 42>
- <addedprice19>
The last one is quite ugly, but still ok. If we use \s+ instead there must be at least one whitespace character so the last one, <addedprice19>, would not be valid then. That is why we have \d+ and not \d*. It makes no sense not to have a number in the added_price tag. The ( ) is used for the backreference. I.e. whatever is matching that in the parentheses are going in the $1, $2, etc. depending which grouping it is. (?: ) is used for when you do not want to include it in the $1, $2, etc.
When releasing a script it is usually a good idea to clean up old debugging code.
#msgbox_p(line)
I would also say your comments are a bit too verbose.
Take for example
def add_armor_price
@price += SEM::AUTOPRICE::ARMOR_PRICE
end # add_armor_price
The comment there give no new nor important information. Just keep it like this instead:
def add_armor_price
@price += SEM::AUTOPRICE::ARMOR_PRICE
end
Another example:
def add_equipment_price
for i in 0..7
# for each stat
@price += SEM::AUTOPRICE::STAT * self.params[i]
end # for each stat
end # add_equipment_price
Here I would change the comments thus:
def add_equipment_price
# For each stat
for i in 0..7
@price += SEM::AUTOPRICE::STAT * self.params[i]
end
end
What do you think? Does it make sense?
*hugs*
- Zeriab