I can't seem to figure out why this isn't functioning properly

Upon examining the script, you'll notice the interval() function at the very bottom. The issue arises from bc-(AEfficiency*100)/5; monz+((AEfficiency*100)/5)((AFluencyAProduct)/100); For some reason, "bc" and "monz" remain unchanged. Why is that so? The change will only take effect after clicking on "Generate Dealer" while running the html file. Seeking assistance.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Sweetness Overload</title>
<style>
body{
font-size:20px;
margin:0;
overflow:hidden;
}
#sweets{
font-size:30px;
position:fixed;
top:1.0%;
left:1.0%;
text-align:center;
user-select:none;
-moz-user-select:none;
-khtml-user-select:none;
-webkit-user-select:none;
-o-user-select:none;
}
#sweets:hover{
text-decoration:underline;
cursor:pointer;
}
#sweetsMenu{
display:none;
position:fixed;
top:6.0%;
left:0%;
padding:0.5em 0.5em;
text-align:left;
vertical-align:top;
background-color:lightgray;
border:2px outset lightgray;
}
#sweetsMenu div{
margin:0.0em 0em;
}
#sweetsMenu p{
margin:0.5em 0em;
}
#dealers{
font-size:30px;
position:fixed;
top:1.0%;
right:1.0%;
text-align:center;
user-select:none;
-moz-user-select:none;
-khtml-user-select:none;
-webkit-user-select:none;
-o-user-select:none;
}
#dealers:hover{
text-decoration:underline;
cursor:pointer;
}
#dealersMenu{
display:none;
position:fixed;
top:6.0%;
right:0%;
padding:0.5em 0.5em;
text-align:left;
vertical-align:top;
background-color:lightgray;
border:2px outset lightgray;
}
#dealersMenu div{
margin:0.0em 0em;
}
#dealersMenu p{
margin:0.5em 0em;
}
#cash{
font-size:30px;
position:absolute;
bottom:1.0%;
width:100%;
text-align:center;
user-select:none;
-moz-user-select:none;
-khtml-user-select:none;
-webkit-user-select:none;
-o-user-select:none;
}
#cash:hover{
cursor:default;
}
#click{
user-select: none;
-moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
-o-user-select: none;
}
#click:hover{
text-decoration: underline;
cursor: pointer;
}
#bc5{
color:gray;
float:right;
user-select: none;
-moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
-o-user-select: none;
}
#AProperties{
display:none;
color:gray;
float:right;
user-select: none;
-moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
-o-user-select: none;
}
</style>
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-33914917-1']);
  _gaq.push(['_setDomainName', 'dhmholley.co.uk']);
  _gaq.push(['_trackPageview']);

  (function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
</head>
<body onload="initialise()">

<div id="blackBox2">
<div id="blackBox"></div>
</div>

<div id="cash">
<span id="monz"></span>
</div>

<div id="sweets" onclick="toggleSweets()">Sweets</div>

<div id="sweetsMenu">
<div id="click" onclick="buyBC()">Bulk Candy (<span id="bccost"></span>)</div>
<div id="txt"><span id="bc"></span> <span id="bc5"></span></div>
</div>

<div id="dealers" onclick="toggleDealers()">Dealers</div>

<div id="dealersMenu">
<div id="click" onclick="genDeal()">Generate Dealer (<span id="crntdeal"></span>/<span id="maxdeal"></span>)</div>
<div id="txt"><span id="dealerA"></span> <span id='AProperties'></span></div>
</div>

<script>
var monz = 10000;
timer = 0;
crntdeal = 0;
maxdeal = 1;
genEfficiency = 0;
genFluency = 0;

bccost = 1500;
bcr = 180;
bcp = 0;
bc = 0;
bc5 = bc * 5;
bcprice = 500;

dealerA = 'A';
AEfficiency = 0;
AFluency = 0;
AProduct = bcprice;

function initialise(){
getCash();
getSweets();
getDealers();
setInterval(interval,25);
}

function getCash(){
document.getElementById('cash').innerHTML = monz / 100 + "$";
}

function getSweets(){
bc5 = bcp * 5;
document.getElementById('bccost').innerHTML = bccost / 100 + "$";
document.getElementById('bc').innerHTML = bc / 100 + "g";
document.getElementById('bc5').innerHTML = bc5 / 100 + "g/sec";
}

function getDealers(){
document.getElementById('crntdeal').innerHTML = crntdeal;
document.getElementById('maxdeal').innerHTML = maxdeal;
document.getElementById('dealerA').innerHTML = dealerA;
document.getElementById('AProperties').innerHTML = (AProduct*AFluency)/100+"$/g"+" | "+AEfficiency+"g/sec";
}

function toggleSweets(){
var sweetsMenu = document.getElementById('sweetsMenu');
if (sweetsMenu.style.display != 'block'){
sweetsMenu.style.display = 'block';
} else {
sweetsMenu.style.display = 'none';
}
}

function toggleDealers(){
var dealersMenu = document.getElementById('dealersMenu');
if (dealersMenu.style.display != 'block'){
dealersMenu.style.display = 'block';
} else {
dealersMenu.style.display = 'none';
}
}

function buyBC(){
if (monz >= bccost){
monz = monz - bccost;
bccost = bccost + bcr;
bcr = bcr + 25;
bcp += 4;
}
}

function genDeal(){
if (crntdeal < maxdeal){
genEfficiency = Math.floor((Math.random() * 5) + 1);
genFluency = Math.floor((Math.random() * 5) + 1);
if (crntdeal == 0){
AFluency = genFluency * 0.1 + 1;
AEfficiency = genEfficiency;
AProperties = document.getElementById('AProperties');
AProperties.style.display = 'block';
}
crntdeal ++; 
getDealers(); 
 }
}

function interval(){
timer ++;
if (timer >= 8){ 
bc += bcp // this line
if (bc >= (AEfficiency*100)/5){ 
bc-(AEfficiency*100)/5; 
monz+((AEfficiency*100)/5)*((AFluency*AProduct)/100);
}
timer = 0;
}

getCash();
getSweets();
}
</script>
 
</body>
</html>

Answer №1

modify the following

bc-=(AEfficiency*100)/5;
monz+=((AEfficiency*100)/5)*((AFluency*AProduct)/100);

make sure to include the = sign to properly assign the value.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Express framework in NodeJS encounters an undefined header error

Utilizing Microsoft Flow to dispatch an HTTP POST request to my server, the request body includes a custom header known as "Email-To" with a string value. Here is the body: { "$content-type": "multipart/form-data", "$multipart": [ { "headers ...

How to retrieve documents in ElasticSearch based on field values containing or including specific values

I am attempting to retrieve documents from elastic search based on fields that include or contain dynamic text. For example: Here are some sample documents retrieved from elastic { id: 12345, name: test66, description: 'some desc231431', entity_i ...

Align both the image and text in the center with no space between

How can I center two blocks containing both images and text vertically and horizontally while using flexbox? I notice that when the text is longer, padding appears between the image and the text. How can I remove this padding?1 .product-teaser { width ...

"When running next build, NextJS fetch() function throws an error indicating an invalid URL, but everything works fine when using

Currently, I am in the process of developing a NextJS React application and attempting to retrieve data from my server by using the following line of code: let data = await fetch('/api/getAllAlumniInfoList').then(res => res.json()) Interestin ...

Retrieve information from an SQL database using user input in a Classic ASP form without the need to refresh the page

Currently, I am in the process of incorporating a new function into an existing Classic ASP system. This feature involves allowing users to scan a barcode that will automatically populate a text field within a form inside a bootstrap modal. The scanner has ...

Mastering the art of constantly monitoring data changes in a Firebase real-time database using Vue.js

I am currently utilizing vue.js version 2 in CDN mode. I have designed 2 vue components - one that pushes data to a database and another that displays it. Here is the code snippet: firebase.database().ref().on('value', function (data) { c ...

Redesigning the reset Zoom feature of HighCharts using a button inspired by Material UI styling

Currently, I am developing a project that incorporates HighCharts and Material UI for the user interface design components. I am wondering if there is a method to substitute the default HighChart reset Zoom button with the Material UI button component? ...

Sketch a straight path starting from the coordinates x,y at a specified angle and length

Is there a way to draw a line in Javascript starting from a specific x/y position with a given length and angle, without having to define two separate points? I have the x/y origin, angle, and length available. The line should be placed on top of a regula ...

Using JavaScript/TypeScript to sort through and separate two arrays

Creating a list of checkboxes on a UI allows users to toggle and filter data results. To achieve this, I am storing the selected checkboxes as a string array. The structure of my code is outlined below: export interface IMyObjectFromAPI { status: { ...

Injecting services differently in specific scenarios in AngularJS

I have a unique angular service called $superService that I utilize across many of my directives and controllers. However, there is one specific directive where I want to implement the following behavior: If another directive utilizes $superService in its ...

What could be the reason for the malfunction of this AngularJS data binding feature?

I am trying to create an angularjs filter that outputs HTML, similar to what is discussed in the link, but I am encountering issues. In my HTML code, I have: <ul> <li ng-repeat="book in books | filter:query"> {{book.title}} ...

Triggering AJAX call from several buttons within a single page in Django

Hey there! I'm currently working on implementing a voting feature using Ajax in my Django-based website. The issue I'm facing is that users can only vote on the first entry, but I want them to be able to vote on all entries. Can you assist me wit ...

Vue: event triggers malfunctioning and components unresponsive

I am new to Vue.js and I'm attempting to trigger an event from my grand-child component (card) to the child component (hand) and then to the parent component (main): card (emit play event) => hand (listen for play event and emit card-play event) ...

Issue: A file that has been uploaded completely ignores the req.on() method in NodeJS

I am currently using MEAN.IO to create a web application. Right now, I am working on implementing an image uploader feature. I have decided to use angular-file-upload for this purpose, and it seems to be functioning well. However, I am facing an issue on ...

I would like a div element to slide up from the bottom of the page

Could someone please assist me in creating a popup div that appears from bottom to top when a specific button is clicked? I would like the div to be fixed without affecting the overall page content. Any help would be greatly appreciated. Thank you! $( ...

What is the best way to distribute a function within a div container?

I'm currently working on a function that manages the show/hide functionality and position of tooltips: tooltip = (e) => { // show/hide and position of tooltip // retrieve element data } In addition, I have div elements whe ...

The Verdana font in Microsoft Word appears with a distinct rendering when converted to an HTML-based

I'm currently working on generating a PDF from an HTML template. Our customer provided the template they previously used in Word, and they require the font to be Verdana. The challenge I'm facing is that Verdana looks smaller and has a different ...

unable to log out firebase user

Currently, I am attempting to sign out the user who is already signed in within my Angular app. Here is my client service code: export class AuthClientService { public register(email: string, password: string): Observable<Object> { retu ...

How to Use jQuery Slice to Display the Top N Items from a Dropdown Menu

How can I display only the top 10 results from multiple UL lists in my navigation? The code snippet provided below currently works for the first list, but how can I extend this functionality to all of the lists? $(document).ready(function() { var elem ...

WebStorm not recognizing NodeJS Core Modules in External Libraries

As a newcomer to NodeJS and WebStorm, I am currently diving into a tutorial on creating an Express app. In the tutorial, the instructor always gets prompted with "Configure NodeJS Core Module Sources" including the URL nodeJS.org when creating a new NodeJ ...