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

Tips for hiding the frame of a React MUI Select component

I am having trouble figuring out how to remove the border around the <Select> component from the React Material UI library. In the image below, you can see that when the <Select> component is not selected, it has a black border/frame. https:// ...

Is it a usual technique to retrieve dynamic content using PhoneGap?

Recently, I've been utilizing phonegap for creating mobile applications on various platforms. I've noticed the need to use AJAX calls within JavaScript to fetch dynamic content. I'm curious, is it a standard practice in HTML5 apps to retrie ...

Eliminate any iframes that have a src attribute with the value of "some_src.com/....."

I'm brand new to coding in javascript. I've noticed that there is an annoying ad popup that manages to sneak through Adblock super without being detected. It's driving me crazy and I want to block it! Here's the code for the iframe: IF ...

Is there a way to view the full HTML source code of this page by selecting the "more" button?

Exploring a web page related to forex trading can be an interesting experience. The website provides a list of live trade records, which can be accessed here: Typically, I use Python along with BeautifulSoup to extract information by reading the source co ...

"Dynamic Addition of Textboxes to Webpages with the Help of jQuery

Currently, I am facing a challenge in adding a textbox to a webpage in ASP.NET MVC using jQuery. My goal is to have a button that, when clicked, appends a text box to the existing collection of Textboxes with a specified class. Below is the jQuery code sni ...

Using Javascript to transmit audio via a microphone

I am currently trying to use Selenium to simulate a user on a website that features audio chat. My goal is to emulate the user speaking through the microphone. While I have come across several resources discussing how to listen to the microphone in JavaSc ...

As the browser window is resized, the gap between images widens while the images themselves decrease

Hey there, I'm encountering some trouble with the image links at the top of my page. As I resize the browser or change screen resolutions in media queries using percentages, the images are resizing accordingly. However, I'm noticing that as the i ...

The reducer I have is inexplicably returning undefined even though I'm certain it was added to combineReducers

After countless hours of debugging, everything seems to be in working order but the problem still persists. The main reducer file is located at reducers/index.js // @flow import { combineReducers } from "redux"; import blocks from "./blocks"; import user ...

The AbortController feature does not initiate the cancellation of an axios.get request

Currently, I'm experimenting with utilizing AbortController to cancel an API call. The axios library is being used for this particular call. Before integrating it into my project, I decided to test the cancellation procedure with a simple call: const ...

ReactJS bug: Array rendering problem affected by recent changes

Why does ReactJS remove the first element instead of the middle element when using array.splice to remove an element from an array? This is my code. I am using Redux as well. const reducerNotesAndLogin = (state = initialState, action) => { var tableNo ...

Make TextField with type number forcibly show dot as decimal separator

I am currently utilizing the material-ui library to display a TextField component in my react application. Strangely, all instances of <TextField type="number /> are displaying decimal separators as commas (,) instead of dots (.), causing confusion f ...

`Troubleshooting Firebase Cloud Functions and Cloud Firestore integration`

I previously used the following Firebase Database code in a project: const getDeviceUser = admin.database().ref(`/users/${notification.to}/`).once('value'); Now, I am attempting to convert it for Firestore. My goal is to retrieve my users' ...

Utilizing StyleFunctionProps within JavaScript for Chakra UI Enhancements

I need help figuring out how to implement StyleFunctionProps in my Chakra UI theme for my NextJS project. The documentation on Chakra's website provides an example in Typescript, but I am working with Javascript. Can someone guide me on adapting this ...

What is the process for installing fontawesome using npm?

I encountered an error while attempting to install that looks like the following: $ npm install --save @fortawesome/fontawesome-free npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\Admin\Desktop\package.json&a ...

Shape with smoothed corners

Is there a way to create rectangles with rounded corners using CSS, SVG, or other methods while maintaining straight horizontal and vertical sides? I attempted to use border-radius for the rounded corners, but found that it created curved edges on both ho ...

Running tests to check for next(err) functionality using supertest and Express JS

When using Express in a route or middleware, you can halt the callback chain by calling next(err) with any object as err. This feature is well-documented and simple to understand. However, I encountered an issue when testing this behavior with SuperTest. ...

Position the flex item adjacent to the initial flex item using wrap mode only if there is extra space

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> <titl ...

Getting the hang of revealing a div through flashing

Is it possible to make a div flash using CSS alone? My goal is to have this div alternate between two colors. .chat-window .msg-container-base .notification-message-unread{ float: right; font-size: 10px; color: #666; background: white; padding ...

Guide on displaying link parameter information on a separate webpage using only JavaScript

While doing some research, I came across an issue. I have a page called specifications.html with three links: details.html?id=1, details.html?id=2, and details.html?id=3. My goal is to display the details of each link when someone clicks on it. For examp ...

Suggestions for placing a script under the scripts menu in Illustrator CS5.1

My script for Adobe Illustrator CS5.1 is not showing up in the scripts menu despite trying to place it in various directories such as: C:\Program Files\Adobe\Adobe Illustrator CS5.1\Presets\en_GB\Scripts\ C:\Progra ...