ADRIFT Forum


The place to discuss the ADRIFT Interactive Fiction toolkit

Looping issue..with a card deck

This forum is the place to learn about and discuss ADRIFT 5. Feel free to mention any bugs you find here, but please also add these to the Bugs & Enhancements list.

Please also refer to the ADRIFT 5 Wiki for more information.

Looping issue..with a card deck

Postby DazaKiwi » Wed Jan 29, 2020 4:37 am

I'm making a basic card deck gameplay not as traditional playing cards it will be a kin to having spell cards or magic the gathering and what not.

I've run into a snag with it and i kind of know what is happening but not why it is i will try and explain below.

The player has only 3 cards for a hand and when a card is played followed with the player drawing a new card a series of tasks with the use of a loop will match the RNG (1,8) number drawn (deck limit is 8 cards) and restrictions for the 3 task will check to see if the number hasn't been used before and matches an empty slot.

The task that runs 3 times and calls 3 tasks that is for finding an empty slot and the number hasn't been used before. What IS happening is the last number (last run of the loop) rolled gets supposedly picked as the task passes and outputs such. But in actual fact its the first loop that the rng number is actually added to the players hand.
Ive added some debug text in the tasks to help trouble shoot this.

I am hoping someone can tell me why... :anyone:
Attachments
CardDeckSystemV2_2.taf
(17.46 KiB) Downloaded 54 times
User avatar
DazaKiwi
 
Posts: 743
Joined: Thu Oct 21, 2010 9:05 am
Location: New Zealand
Points: 61

Re: Looping issue..with a card deck

Postby DazaKiwi » Fri Feb 07, 2020 2:06 am

After a bit of a break from this demo i came back to it with fresh eyes and got it working. I created a variabled called MatchFound and the other 3 tasks (Deal 3 cards at Start Part 1,2,3) now have MatchFound = 0 in its restrictions. Then i created a system task that is run after those 3 to check if there is an empty slot still and will restart the whole process again (this is for the very start of the demo to fill up the players hand with 3 cards). So now it is running as i originally intended it to. I may as well attach the new change for those who want a simple card system for non-playing card style game where some cards could be power-ups, resource gains, weapons etc.
Attachments
CardDeckSystemV4.taf
*Updated to fully working version
(17.54 KiB) Downloaded 37 times
User avatar
DazaKiwi
 
Posts: 743
Joined: Thu Oct 21, 2010 9:05 am
Location: New Zealand
Points: 61


Return to ADRIFT 5.0

Who is online

Users browsing this forum: No registered users and 6 guests