To get this idea better, is to explain real case situation.

I am making this card game just to practice some new coding technics, and there is constantly one problem that i encounter all the time which makes the code very messy.

Situation is this.

1. Player chooses to build one of his cards.

2. After choosing which card to build, he needs to choose which cards to use to pay it.

3. in case payment is not exact payment, he needs to choose which cards to take as change (basically, if you buy 2 euro stuff, and you pay with 5 euro sedel, you then get to choose what kind of change to get back.

As I am trying to do this all using WaitEvent() system, I cant really figure out how to do this any simple and clean way, but I have to make several functions:

Code: Select all

```
Function makebuildablecardspickable
foreach card
if card = buildable card then card.leftmousebuttonfunction=pickingbuildingcard
next
endfunction
function pickingbuildingcard
resetcardsleftmousefunctions()
makepricecardschoosable()
price = card.price
endfunction
function resetcardsleftmousefunction()
foreach card
card.leftmousebuttonfunction = fefaultfunction
next
endfunction
function makepricecardschoosable()
foreach card
if card = pricecard then card.leftmousebuttonfunction=payabuilding
next
endfunction
function payabuilding
price = price - card.price
if price = 0 donepaying
if price < 0 then getchange
endfunction
function getchange
---
endfunction
```

What I would like to be able to do, would be soemthing like this:

Code: Select all

```
Function BuildABuilding
foreach card
if card = buildable card then card.leftmousebuttonfunction=pickingbuildingcard
next
breakfunc(1)
resetcardsleftmousefunctions()
makepricecardschoosable()
price = card.price
endfunction
breakfunc(1)
price = price - card.price
if price = 0 donepaying
if price < 0 then getchange
endfunction
function pickingbuildingcard()
continuefunc(1)
endfunction
function payabuilding
continuefunc(1)
endfunction
function
```

Would this be doable?