To make my game more dynamic, I have created a script in which arguments are used in order to be substituted by pre defined variables.
Upon clicking the left mouse_button, there is the code:
script_execute(scrShoot, weapon1, ammo1);
Where weapon1 and ammo1 are local variables.
The simple script 'scrShoot' is as follows:
if argument0 = 1
{
argument1 -= 0.05;
instance_create(x,y,objBullet);
}
if argument0 = 2
{
argument1 -= 0.05;
repeat(4)
{
instance_create(x,y,objBullet2);
}
}
argument0 works as expected, being successfully substituted by weapon1, however, the variable ammo1 never decreases.
When I manually write in ammo1 in place of argument1, the script works fine; decreasing by 0.05 with every click.
Other tests using scripts have lead me to believe that the problem lies with using variables to substitute arguments: strings and numbers work as you would expect.
I have encountered this problem in more than one scenario and I'm baffled that nobody else on the internet seems to have come across the same problem.