Solved

Filemaker pro 11: using variables

Posted on 2010-11-29
5
680 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 25

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 25

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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How do I Test SQL in Filemaker 13? 3 215
FMP auto filed input? 3 143
send mail from Filemaker Pro 10 4 127
filemaker security 1 846
Problem: You have a hosted FileMaker database and users are tired of having to use Open Remote or Open Recent to access the database. They say, "can't you just give us something to double-click on rather than have to go through those dialogs?" An…
Having just upgraded from Filemaker 11 to Filemaker 12 over the weekend, we thought we would add some tips for others making the same move.  In general, our installation went without incident. Please note that this is not a replacement for Chapter 5…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

751 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