PDA

View Full Version : Math container to figure MPH in Ex Temp ?



Eldyn
May 6th, '04, 06:52 PM
Hi

I'm trying to get MPH to print on an export template and having a difficult time of it :)

This is one of the ways I've tried :

<td><font size=1><!--MATH-->(<!--RUNNING_TOTAL_NONCOMBAT-->*<!--SPD_TOTAL-->*300)/804.5<!--/MATH--></font></td>

But it doesnt work .. so obviously im missing something.

Thanks for the help in advance

Eldyn

RPMiller
May 6th, '04, 09:11 PM
The problem that you are encountering is two-fold. First, SPD_TOTAL should be inside the SPD container, secondly and more importantly RUNNING_TOTAL_NONCOMBAT doesn't return a number. Note the quotes that follow the number. I'm not sure if there is a tag for just the number however.

Simon
May 7th, '04, 05:47 AM
RP pretty much hit it on the head.

RUNNING_TOTAL_NONCOMBAT will never work for you, as it not only includes the " after the number, it will also include a "/" and the secondary value, if available.

I just added in a new series of export tags that you will want to use.

For running, you have:

RUNNING_PRIMARY_NUMBER
RUNNING_SECONDARY_NUMBER
RUNNING_PRIMARY_NONCOMBAT_NUMBER
RUNNING_SECONDARY_NONCOMBAT_NUMBER

Take your pick of those four.

You'll need to grab the interim build in order to use them.

Trailblazer
May 7th, '04, 07:23 AM
These are great, exactly the kind of thing I was looking for earlier! I hesitate to ask, but is there any chance similar tags could be added for the other forms of movement, and possibly for STR_LIFT as well? If not, that's OK; even this one by itself is a help.

Thanks much!
Daryl

Simon
May 7th, '04, 07:25 AM
These are great, exactly the kind of thing I was looking for earlier! I hesitate to ask, but is there any chance similar tags could be added for the other forms of movement, and possibly for STR_LIFT as well? If not, that's OK; even this one by itself is a help.

Thanks much!
Daryl They're already in for other forms of movement (check the export tag document).

For STR_LIFT, you're going to need to use REG_REPLACE tags. A bit of clever tinkering with that and you should be fine (hint: you can put the STR_LIFT tag inside of a REG_REPLACE container to match the exact value).

RPMiller
May 7th, '04, 07:28 AM
Could you add *_TOTAL_NUMBER, and *_TOTAL_NONCOMBAT_NUMBER? That would be great! I'll have a new Export Template up shortly. :D

Simon
May 7th, '04, 07:30 AM
Could you add *_TOTAL_NUMBER, and *_TOTAL_NONCOMBAT_NUMBER? That would be great! I'll have a new Export Template up shortly. :D No. Those values are inherently non-numeric, as they include the secondary total (if it differs from the primary).

If you are looking for a numeric value, then you need to specify whether you want the primary or the secondary value.

RPMiller
May 7th, '04, 07:39 AM
No. Those values are inherently non-numeric, as they include the secondary total (if it differs from the primary).

If you are looking for a numeric value, then you need to specify whether you want the primary or the secondary value.
Ah. I haven't worked on a character that had movement added to secondary recently so had forgotten about that. Thanks!

Is there a way to check for a different secondary like the IF_SECONDARY tag on the chararacteristics?

Simon
May 7th, '04, 07:41 AM
Ah. I haven't worked on a character that had movement added to secondary recently so had forgotten about that. Thanks!

Is there a way to check for a different secondary like the IF_SECONDARY tag on the chararacteristics? There are no explicity tags for it at this point, but you could manage with with REG_REPLACE.

RPMiller
May 7th, '04, 08:28 AM
I think I'm doing something wrong. I'm getting exactly the same values for PRIMARY and SECONDARY tags on movement. Is that correct?

Here is the template. Look in the movement section after characteristics.

Simon
May 7th, '04, 08:30 AM
I think I'm doing something wrong. I'm getting exactly the same values for PRIMARY and SECONDARY tags on movement. Is that correct?

Here is the template. Look in the movement section after characteristics. If the character has the same value for their secondary movement, then yes, it is correct. They will only differ if part of the Movement Power is purchased as adding to secondary totals only.

Trailblazer
May 7th, '04, 08:34 AM
They're already in for other forms of movement (check the export tag document).

For STR_LIFT, you're going to need to use REG_REPLACE tags. A bit of clever tinkering with that and you should be fine (hint: you can put the STR_LIFT tag inside of a REG_REPLACE container to match the exact value).
Fantastic! That's exactly what I was looking for. I'll check the document.

Thanks very much! :thumbup:

Eldyn
May 7th, '04, 03:07 PM
Thanks guys!

I'll use the new tags. Was about to mess around with java script, something like ncs=parseint(ncstr.substring(1,(ncstr.length-1)), but that was before I knew there was a slash and second number in the string.

When im done I'll post the template if anyone is interested. :)

Eldyn
May 9th, '04, 11:57 AM
Hi

Here's the template. I rearranged the order of things a little, in an effort to get a character with a lot of powers to print on one page.

Basically I removed the image and moved the skills and perks to the third column. Also there is a MPH box in the first column. This will list the MPH for running, flight or teleport powers.

Hope you can use it
Eldyn

Trailblazer
May 11th, '04, 07:12 AM
They're already in for other forms of movement (check the export tag document).

For STR_LIFT, you're going to need to use REG_REPLACE tags. A bit of clever tinkering with that and you should be fine (hint: you can put the STR_LIFT tag inside of a REG_REPLACE container to match the exact value). Dan,

Following up on this, are you sure this can be done? I've tried every trick with REG_REPLACE I can think of (including putting STR_LIFT inside the REG_REPLACE container several different ways), and even though I have no trouble getting just the number to appear in the export, the MATH container won't accept it as valid input (it always returns a -1).

I did notice that STR_LIFT does also output a slash followed by a secondary value if the character has secondary strength, and the "kgs" suffix can change to "tons" if STR is high enough. I can successfully reduce all this to just a single number too in a variety of ways, but MATH still doesn't like it.

Am I missing something?

Thanks!

Simon
May 11th, '04, 07:54 AM
Dan,

Following up on this, are you sure this can be done? I've tried every trick with REG_REPLACE I can think of (including putting STR_LIFT inside the REG_REPLACE container several different ways), and even though I have no trouble getting just the number to appear in the export, the MATH container won't accept it as valid input (it always returns a -1).

I did notice that STR_LIFT does also output a slash followed by a secondary value if the character has secondary strength, and the "kgs" suffix can change to "tons" if STR is high enough. I can successfully reduce all this to just a single number too in a variety of ways, but MATH still doesn't like it.

Am I missing something?

Thanks!Apparently so. The only time the MATH container will return -1 is when it runs into non-numeric characters.

I would recommend checking over your regular expressions and verify that they are doing what you think they are.

A good idea would be to remove the MATH tags completely to see what values are being passed into them.

Trailblazer
May 11th, '04, 08:08 AM
Apparently so. The only time the MATH container will return -1 is when it runs into non-numeric characters.

I would recommend checking over your regular expressions and verify that they are doing what you think they are.

A good idea would be to remove the MATH tags completely to see what values are being passed into them.
That's what I did. :) That's how I knew that I had successfully reduced the STR_LIFT string to just the numbers. I even checked the exported HTML output just to be doubly sure.

But knowing that bit about the MATH container is helpful. I'll check again, just in case. I'd show you what I'm working with, but I've tried so many different combinations that I wouldn't know which one to post.

If I get it working, I'll post the templates in case someone might find them useful as examples.

Thanks again!

RPMiller
May 11th, '04, 08:20 AM
There are no explicity tags for it at this point, but you could manage with with REG_REPLACE.
In addition to Trailblazer's REG_REPLACE problem, I'm having a heck of a time trying to figure out what the string would be for my PRIMARY/SECONDARY issue.

Could you offer some more ideas in getting the SECONDARY values to show up only when they are different from the PRIMARY?

Simon
May 11th, '04, 09:45 AM
In addition to Trailblazer's REG_REPLACE problem, I'm having a heck of a time trying to figure out what the string would be for my PRIMARY/SECONDARY issue.

Could you offer some more ideas in getting the SECONDARY values to show up only when they are different from the PRIMARY? How you do it is going to be up to you. I'd recommend using the REG_REPLACE to check for equality between the two values. If you can't do that, then you may need to change your concept slightly.

Trailblazer
May 15th, '04, 08:06 AM
OK, I've finally had time to get back to this.

As near as I can tell, it appears that the MATH container doesn't want anything to do with text that has been REG_REPLACEd, even if the resulting replacement consists only of numbers, whether floating point or not (I tried separating the integral portion from the decimal portion with the same "-1" result).

It's worth noting that I've had no trouble at all with the MATH container when using literal numbers with the normal numerical tags.

Here is a simpllified text template that illustrates what I'm seeing:

<!--TEMPLATE_NAME-->AAAText Test<!--/TEMPLATE_NAME-->
<!--STR--><!--STR_LIFT--><!--/STR-->
<!--STR-->x<!--STR_LIFT-->x<!--/STR-->
xx100.0xx
<!--REG_REPLACE--><!--REGSTRING-->xx(\d+\.\d)xx<!--/REGSTRING--><!--REPSTRING-->$1<!--/REPSTRING--><!--/REG_REPLACE-->
<!--REG_REPLACE--><!--REGSTRING-->x(\d+\.\d)([a-zA-Z]+)x<!--/REGSTRING--><!--REPSTRING--><!--MATH-->$1+1<!--/MATH--> $2<!--/REPSTRING--><!--/REG_REPLACE-->
<!--REG_REPLACE--><!--REGSTRING-->(\d+\.\d)([a-zA-Z]+)<!--/REGSTRING--><!--REPSTRING-->$1 $2<!--/REPSTRING--><!--/REG_REPLACE-->

I've included three examples to illustrate that the regexes above have no trouble matching and separately returning the number and text portions of STR_LIFT using backreferences. For simplicity, I didn't include here the ability to handle secondary values separated by a slash, but that's easy enough to do as well.

When exporting a new, unmodified character using this template, the following results:

100.0 kg
-1 kg
100.0

So, the problem doesn't seem to be with the regexes but rather with MATH accepting the output, as in the second line, though I have no idea why that would

Am I doing something wrong?

Thanks!
Daryl

Trailblazer
May 15th, '04, 08:11 AM
Hmm, that template didn't come out right. Let me attach it instead.

Simon
May 15th, '04, 10:39 AM
OK, I've finally had time to get back to this.

As near as I can tell, it appears that the MATH container doesn't want anything to do with text that has been REG_REPLACEd, even if the resulting replacement consists only of numbers, whether floating point or not (I tried separating the integral portion from the decimal portion with the same "-1" result).

It's worth noting that I've had no trouble at all with the MATH container when using literal numbers with the normal numerical tags.

Here is a simpllified text template that illustrates what I'm seeing:

<!--TEMPLATE_NAME-->AAAText Test<!--/TEMPLATE_NAME-->
<!--STR--><!--STR_LIFT--><!--/STR-->
<!--STR-->x<!--STR_LIFT-->x<!--/STR-->
xx100.0xx
<!--REG_REPLACE--><!--REGSTRING-->xx(\d+\.\d)xx<!--/REGSTRING--><!--REPSTRING-->$1<!--/REPSTRING--><!--/REG_REPLACE-->
<!--REG_REPLACE--><!--REGSTRING-->x(\d+\.\d)([a-zA-Z]+)x<!--/REGSTRING--><!--REPSTRING--><!--MATH-->$1+1<!--/MATH--> $2<!--/REPSTRING--><!--/REG_REPLACE-->
<!--REG_REPLACE--><!--REGSTRING-->(\d+\.\d)([a-zA-Z]+)<!--/REGSTRING--><!--REPSTRING-->$1 $2<!--/REPSTRING--><!--/REG_REPLACE-->

I've included three examples to illustrate that the regexes above have no trouble matching and separately returning the number and text portions of STR_LIFT using backreferences. For simplicity, I didn't include here the ability to handle secondary values separated by a slash, but that's easy enough to do as well.

When exporting a new, unmodified character using this template, the following results:

100.0 kg
-1 kg
100.0

So, the problem doesn't seem to be with the regexes but rather with MATH accepting the output, as in the second line, though I have no idea why that would

Am I doing something wrong?

Thanks!
Daryl MATH tags are evaluated before the REPLACE and REG_REPLACE tags.

Meaning: you are passing non-numeric values into the MATH container (which is resulting in the -1 return)

Trailblazer
May 15th, '04, 09:00 PM
MATH tags are evaluated before the REPLACE and REG_REPLACE tags.

Meaning: you are passing non-numeric values into the MATH container (which is resulting in the -1 return)
Then I'm confused, because earlier, you said in the Export Tags thread that:


Pushed up new zip file containing the new MATH ... /MATH container.

The MATH container is evaluated after all other tags (including the REPLACE and REG_REPLACE containers) and must contain only simple mathematical formulae. Parentheses are allowed, so you can have equations of the form:

1+(5*(2+3)+4)/5

Since the MATH container is evaluated after all others, you may include other tags within the MATH container - they will be swapped out prior to evaluation.
That's why I tried this approach in the first place. Certainly the former seems to be true based on what I've seen. So are you saying that REG_REPLACE can still be used to process STR_LIFT somehow? If so, I haven't seen any implementation notes on regular expressions that would permit that. Can you point me in the right direction?

Thanks,
Daryl

Simon
May 16th, '04, 06:55 AM
I misspoke before. The replace tags are the last tags evaluated. When I was initially putting the math and replace tags into the app, the need was to have the math tags evaluated first, so that's how it was done.

Trailblazer
May 17th, '04, 02:49 AM
That's too bad; I was rather hoping for the opposite behavior.

So, unless the implementation of regex that HD is using is capable of math, it looks like I'm out of luck. I haven't seen a regex that can do that; rather beyond the scope of its function, I would think.

In any event, thanks for taking the time to answer on the weekend!