Solved

Filemaker pro 11: using variables

Posted on 2010-11-29
5
676 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 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

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…
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

809 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