+1
Є відповідь

Passing vars

Lcdrgreg 12 років тому оновлений 12 років тому 2
we are creating a game within an app to determine if people lived or died in Quantrills raid...

I have put the images in a pager.
I have assigned pagenumber vars, ie _pagenum="1"
how do I pass that pagenumber to the action for the select buttons for survived or perished? In this case its a set of buttons at the bottom. tombstone, bday cake.

I also want to keep track of the number of correct responses with a running tally.

thanks
You can do this pretty easily using the "page" object property of the pager.

You action will need to look something like this:

<action name="tombstone" >
<assign property="object:PAGER.page" value="[var:page]" />
<if lhs="[var:page]" operator="e" rhs="1">
<alert title="CORRECT!" message="You are right. Page 1 Image Name is Dead. "/>
<assign property="var:total" value="[eval: [var:total]+1]" />
</if>
etc....
</action>

<action name="cake" >
<assign property="object:PAGER.page" value="[var:page]" />
<if lhs="[var:page]" operator="e" rhs="1">
<alert title="INCORRECT!" message="You are wrong. Page 1 Image Name is Alive. "/>
</if>
etc....

</action>
Sorry guys, figured it out after iteration 700... thanks, still working on a tally mechanism though...