Solved

Filemaker pro 11: using variables

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

821 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