Create your own Interactive Fiction

ADRIFT - Interactive Fiction  
Home   |   News ADRIFT News RSS   |   Screenshots   |   Download   |   Games ADRIFT Reviews RSS   |   Forum   |   Help   |   Links
Welcome Guest Register | Login
Popular Games
Pete's Punkin Junkinator
Skybreak v. 1.4
The Sisters
Synonymizer
Notebook Demo
The Makeshift Magician
Escape to New York v1.1
Hold Breath
Return to Camelot
Ectocomp 2009
 
Latest Forum Posts
Constellaris Court
Happy birthday reelyor
New Game Uploaded: THINGS THAT GO BUMP IN THE NIGHT
Dominion of Darkness - interactive story of the Dark Lord/Lady
Belated happy birthday saabie!
Object groups?
Happy birthday Denk & Andrew
InsideADRIFT Back Issues
Hi everyone
Happy birthday, David
 
Latest Reviews
DRAM 321 Final
Goldilocks is a FOX!
Xanix - Xixon Resurgence
Finn's Big Adventure
Bug Hunt On Menelaus
Magor Investigates...
Classic Adventure
Private Eye
Roozden's Color Code Module
Wumpus Hunt

Make a donation

Cursor  Setting score variable to an array element reference with a variable results in errormessage

Issue Type: Status: Priority: Date Submitted: Votes:
Bug Open Low Fri 21st Jun 2013 2 votes Vote Up Vote Down
 
Found in version: Last Updated: Completed in version: Date Completed: Track Changes:
5.0.30.1 Mon 24th Jun 2013 Log In
 
Fri 21st Jun 2013 12:07
Using a task and setting the score like this:

Set Score to %Score%+%Array[%Index%]%

yields an out-of-bounds array error if %Index% is initialized as 0 in the game. This happens even if the game itself changes the %Index% before the score setting task is run. This can be a pain when making a lot of use of the %number% argument to set scores.

I created the following work around to stop the beeping error messages:

Set Score to %Score%+%Array[max(%Index%,1)]%

But it shouldn't happen in the first place :).
 
saabieSat 22nd Jun 2013 05:49
%Score% is a special system variable that contains special logic to prevent it being updated more than once by any given task, and to sum all of the score's to calculate the value of %MaxScore%.
Whenever you enter an equation like %Score%+%Array[%Index%]%, ADRIFT will immediately calculate Set MaxScore to %MaxScore%+%Array[%Index%]%, and as the array index is wrong then you should be getting an error.
If you add anything other than a constant to %Score% then %MaxScore% will be wrong anyway.
You should create your own variable and use that instead of %Score% if you are going to do anything different than what it was intended for.
 
Sat 22nd Jun 2013 14:25
Ah saabie, thanks. I'll think of a way to work around this. But I actually like the only-one-trigger-aspect of the score system.
 
saabieMon 24th Jun 2013 01:18
You can do the same thing with your own score variable by putting each score increase in a specific task that is set to only run once.
© 2013 Campbell Wild. All rights reserved. | Contact the Webmaster