Solved

Filemaker pro 11: using variables

Posted on 2010-11-29
5
674 Views
Last Modified: 2012-05-10
Hi I'm trying to make a basic text game with filemaker.

Everytime a calculation gives a result of "hit" the player gets 1 hit point.

The formula must remember the hit points status of the player.

Let (hitpoints=1; hitpoints+1)

does not increment (result is alwasy 2).
0
Comment
Question by:johanna_f
  • 2
  • 2
5 Comments
 
LVL 24

Expert Comment

by:Will Loving
ID: 34232374
Joanna - can you provide either more details or an example file. It sounds like you want to be using "$" style variable rather than a Let () calculation but I don't really have enough information to understand what you are trying to do...
0
 
LVL 12

Expert Comment

by:North2Alaska
ID: 34232531
The LET will always set hitpoints to 1, so that is not what you want.  I think what you need is an assignment to a field or a variable.  If you go the variable route, I think you would use the double $, $$hitpoints.  Create a script that starts the game to set $$hitpoints to zero.  Then when another script that handles the increment of $$hitpoints.

The reason you would use the $$ is that it is persistent or each run of the database.  A single $ is only persistent for a given script.
0
 

Author Comment

by:johanna_f
ID: 34232575
hi will

the basic game text has a script when dice roll 7 they "hit"

basically what im trying to do is to count +1 hit points when the player got a result of "hit" from the dice roll.

The problem I'm having is that every time I roll the dice with the script button, calculation doesnt store "hit" results.

A normal variable i=i+1 is not just accpeted by the syntax of the calculation, couse it needs a declaration before +1.

Im trying
Case ( defense="hit"; "hit!"
Let ( $$hitpoints = If ( IsEmpty ( $$hitpoints ) ; 1 ; $$hitpoints ) ; $$hitpoints + 1 ))


but without luck for now

I need a way to remeber the health status of the player, so that like when he reaches 10 hits it dies. Right now every time player got hit, resets on next dice rolls.
0
 

Author Comment

by:johanna_f
ID: 34232592
Its ok to use calculation variables or script ones.

Can you send me some working code for it?
0
 
LVL 24

Accepted Solution

by:
Will Loving earned 250 total points
ID: 34232665
Use the SetVariable() script step to set a variable called "$$HitPoints". Use an if statement in your script to that:

If( DiceRoll = 7 )
   SetVariable ( $$HitPoints ; $$HitPoints + 1 )
   If( $$HitPoints >= 10 )
       Custom Dialog ( "Your out!" )
       Halt Script
   End If
End If

I haven't put in all the exact syntax that FileMaker will show in the script editor but this should give you an idea
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Pop up windows can be a useful feature of any Filemaker database.  Though best used sparingly, they can be employed in a multitude of different ways, for example;  as a splash screen at login, during scripted processes to control user input, as pick…
Conversion Steps for merging and consolidating separate Filemaker files The following is a step-by-step guide for the process of consolidating two or more FileMaker files (version 7 and later) into a single file with multiple tables. Sometimes th…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now