Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently January 10th, 2025, 5:42 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: MPG Calculator... (help with variables)
PostPosted: October 12th, 2006, 9:44 am 
Offline

Joined: August 21st, 2006, 8:38 am
Posts: 10
Yesterday I had some free time so thought I'd try to learn something else in Opus, ended up creating a MPG (miles per gallon) calculator. It takes in the miles done, litres used and cost per litre then works out the mpg you have got. I'm really into cars (got a Civic Type R 8)) and have a lot of friends on various places that might find this exe useful. Just having a little problem - the three input boxes are obviously number variables set to 0, is there a way that when I run it, they won't automatically have 0 in (it's a pain having to delete it when inputting your figures).

Other than that I'm quite pleased with it, only been messing with Opus on and off for a few weeks :) 8)


For this message DarrylYoung has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: October 12th, 2006, 1:50 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Darryl

I think I understand what you are trying to achieve, though I'm not 100% sure.

If you place a Pre-Show trigger on the page itself and choose from the programming tab, "variables," then enter the specific variable that you are using for the text input box, and, finally, not choose a specific value, it will leave the variable = "" or nothing. This will reset the variable to nothing each time the page is re-entered for the user to employ the calculator. You can repeat this for each variable. Instead of "0" they will be set to "nothing."

Kind Regards,

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: October 12th, 2006, 1:58 pm 
Offline

Joined: August 21st, 2006, 8:38 am
Posts: 10
Stephen wrote:
Hi Darryl

I think I understand what you are trying to achieve, though I'm not 100% sure.

If you place a Pre-Show trigger on the page itself and choose from the programming tab, "variables," then enter the specific variable that you are using for the text input box, and, finally, not choose a specific value, it will leave the variable = "" or nothing. This will reset the variable to nothing each time the page is re-entered for the user to employ the calculator. You can repeat this for each variable. Instead of "0" they will be set to "nothing."

Kind Regards,


Thanks for that, I've just given it a go and it works -- appreciate it :)

Regards


For this message DarrylYoung has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: October 12th, 2006, 3:32 pm 
Offline

Joined: November 3rd, 2004, 2:08 pm
Posts: 130
Location: Above it all
Darryl I have a question about your equation. If you are using all 3 variables as you stated in your first post wouldn't you come up with a 'cost per mile' answer not a 'miles per gallon'. If you wanted a MPG answer you would not need the cost per liter (Or gallon)


For this message Evereddie has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: October 12th, 2006, 3:37 pm 
Offline

Joined: August 21st, 2006, 8:38 am
Posts: 10
Evereddie wrote:
Darryl I have a question about your equation. If you are using all 3 variables as you stated in your first post wouldn't you come up with a 'cost per mile' answer not a 'miles per gallon'. If you wanted a MPG answer you would not need the cost per liter (Or gallon)


I've got another variable set as a number to 4.54 (that's how many litres there are in a gallon).

Basically, I'd write exactly now how I do it but I'm about to go home from work. I've got it working right and it displays the right mpg :)

Thanks


For this message DarrylYoung has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: October 12th, 2006, 5:15 pm 
Offline

Joined: November 3rd, 2004, 2:08 pm
Posts: 130
Location: Above it all
Darryl, I think you misunderstand my question. If you are using a variable that has to do with price then your answer will also have something to do with price. Price per mile is what stricks me as what you come up with. If you only wanted miles per gallon (or liter) then the cost variable would not be needed.
Example: If I drive 1000 miles and use 30 gallons the the MPG would be 1000 divided by 30 or 33.33 MPG. Haven't used cost variable anywhere to do this.


For this message Evereddie has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: October 12th, 2006, 5:24 pm 
Offline

Joined: August 21st, 2006, 8:38 am
Posts: 10
Sorry yeah I know what you mean. I've got that variable in there as I am next planning to give the user the "cost per mile" in pence - I've not even started doing that as I'm yet to find out how to work it out myself! At the moment it just outputs the MPG into a variable. I'm going to use this variable to work out cost per mile - I hope that's cleared it up (or have I missed your point again?! - it's been a long day!) :)


For this message DarrylYoung has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 82 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group