- Sep 27, 2018
- 270
- 376
Hi all,
I have a player clicking on a number of images.
Depending on the image clicked it will modify a variable.
At the moment I am using a if statement to process this:
However I want to change this so that I can drastically reduce the amount of code and if statements by concatenating 'score' onto the end of the value and modify that variable:
While the below statement won't work (I am not using buttons), this is similar to what I am after...
It is probably painfully simple, I just can't find any examples of it anywhere.
I have a player clicking on a number of images.
Depending on the image clicked it will modify a variable.
At the moment I am using a if statement to process this:
Code:
if dungeon[cardClicked][2] == 0:
if dungeon[cardClicked][0][:3] == "m01":
$ m01score += 1
if dungeon[cardClicked][0][:3] == "m02":
$ m02score += 1
if dungeon[cardClicked][0][:3] == "m03":
$ m03score += 1
if dungeon[cardClicked][0][:3] == "m04":
$ m04score += 1
While the below statement won't work (I am not using buttons), this is similar to what I am after...
Code:
if dungeon[cardClicked][2] == 0:
SetVariable(dungeon[cardClicked][0][:3]+"score", +1)