Solved

Filemaker pro 11: using variables

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

624 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