The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
How to calculate?
I basically want under my postbit template to say
Posts: X Raffle Tickets: X (number) But in order to get that number, I want it to calculate Raffle Tickets by posts / 20 How would I go about doing this? Sorry, I'm a programmer and this seems really easy to make in C++ or Java but not sure with php and html. Thanks |
#2
|
||||
|
||||
What are Raffle Tickets? They are not a default vbulltin thing. You should ask this question in the modification thread where you downloaded the modification.
|
#3
|
||||
|
||||
Its not a modification. Every 20 posts a member makes creates 1 raffle ticket SO,
the equation is: Raffle = Posts / 20 (truncate decimal) EXAMPLE: Raffle = 40 / 20 Raffle= 2. Display: Posts: 40 Raffles: 2 |
#4
|
||||
|
||||
Do raffle tickets go away at any point?
|
#5
|
|||
|
|||
That doesn't make sense. Let's say we have 3 users. A, B, and C. A has 20 posts and thus one raffle ticket. B has 10 posts and no raffle tickets. C has 15 posts and no raffle tickets.
Total posts = 45 Total raffle tickets = 1 if (totalPosts%20 > 9) (posts/20) - 1 = 2 (rounded) else posts/20 = 2 (rounded) ^Still inaccurate according to my above example. 2 != 1 Also, go into your statistics template and get the variable. ($totalposts) |
#6
|
|||
|
|||
Quote:
Code:
<if condition="$post['tickets'] = (int)($post['posts'] / 20)"></if> Total raffle tickets = $post[tickets] |
#7
|
||||
|
||||
Can you use (int) in a template like that?
|
#8
|
|||
|
|||
It seems to work. In fact after I posted this I tried it in vb 4.1.3 and it works there too. I just started working with vb4, I was disappointed to find it didn't work with the vb:math tag - I'm not sure why since there's little documentation in the manual. I guess it doesn't allow parens at all or something.
|
#9
|
||||
|
||||
Do you mean parenthesis? I use those in conditional for wrapping some conditions and they seem to work fine. Unless I got your meaning wrong.
They use the math in the style vars, though. Not that that would mean anything. How's this for some screwed up code? Code:
if ((int)round(abs($postdays)) > 1) |
#10
|
|||
|
|||
Yeah, I'm just lazy. I meant they don't seem to work in the vb:math tag. But I'm probaby like, what, a year and a half behind everyone else figuring that out.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|