Help in designing module

I am finally having time this Sunday to modify the module (it was a busy week).

Yes, that would be a good option, disabling the setup controls; if you would be so kind to explain, thank you.

There is another thing that I wanted to fix.
I was thinking to try to solve it by myself now that I am a bit more aware of it, without bothering you, but since you are so good at it and so helpful, perhaps you can find an easy solution to do it.

I will explain it:

This race game tries to simulate the F1 period between 1955-1959. Each player choses a car (from 12 teams, Ferrari, Vanwall, BRM, Mercedes, Gordini, etc), and then choses a pilot (from a list of 33 drivers (Fangio, Moss, Brabham, etc). Each player has a map window where he does the setup of the car, and changes turn by turn the car’s speed, the tyres and brakes wear, the motor temperature, etc. And then he has a car piece on the mapboard that he manually moves acrosse the race track. At present that car piece has no links with the cockpit; it has (as a prototype) a movement trail, a rotate freely, a delete and a 3 place markers (for spinning, crashing and pitting). When I right click on the car piece it appears the car name and number (I’ve placed a global hotkey command for the sole purpose of showing that car name and number).

I would like to find a way that, when I right click on the car at the race track, it would show the pilot’s name that is driving the car. For the moment, players sides are defined by the cars numbers; pilots are simple cards that each player choses from a deck and drags it to the cokpit car. But from what you’ve taught me I could perhaps set a global property that could link the pilot card chosen in the cockpit to the car piece. Any hints?

Thank you,

yours greatfully

José Miguel

Yesss! With the restricted commands it works perfect! Thank you so much Shilinski!

At first I had some trouble because I didn’t notice that, in order to function, the restricted commands must be at the bottom of the piece’s traits. After I’ve changed the traits’ order it’s fine.

Before I change the module to all cars I’m going to wait for your explanation about disabling the setup controls for each player once the setup phase is done.

Thank you Master!

What the user sees: They will configure their car, and when done, they will press a button at the bottom that means they are finished with setup. If their setup is illegal, a window will pop up telling them that. Otherwise, the setup controls will be permanently disabled, and the button will disappear.

Warning. Since I am not testing this, I could and probably will make mistakes.

  1. First we need to create another global property where we created the “sum” global property. We will call this one “setup_enabled,” and it will start out as “true” (Without the quotes).

  2. Next we edit those restrict command traits. You have two of them. The restrictions are something like ( carsetup_Level == 1 } and ( carsetup_Level == 3). Change them to ( setup_enabled == false || carsetup_Level == 1 } and ( setup_enabled == false || carsetup_Level == 3}. Here we are adding restrictions so that the only time the user can change setup is if setup_enabled is true.

  3. Next we need a way to turn off setup_enabled, and we will do that via a button. This is where you could do some artwork. Make a button that has words on it (you pick) that say the user should press this button when they finish setup. You might be able to get away with a text label trait, but I would prefer a button.

  4. Create a new piece for the button. I’d put it beneath all the other pieces. Set the button image as the piece image. (Or add a text label trait.) Then add the following traits. (I may specify the wrong order. Sorry if I do.)

4a. Does not stack. Allow the piece to be selected, but set everything else to never.

4b. Add the Delete trait. Eliminate any menu text and the default ^D. Instead make the command “delete.” This will go to the left of where the ^D was.

4c. Since we must change the global “setup_enabled,” add the trait “set global property.” Set the property to setup_enabled with initial value true. Add one command: disable. Do not add menu text. Set it so it sets a value directly, and to the far right, set the value to false.

4d. If I recall without me scrolling back to the top of this thread, you have a legal value for your “sum” global property. For the sake of this example, let’s say it is 0. Substitute your true value later.

Add the dynamic property trait. Set the property to “run” and leave the value blank. Add one command. No menu text. The command is “error”. Set value directly. For the value, I suggest you press the little calculator button to the right so it can check your syntax. Add this:
Alert(“Your final car setup must equal 0!”)

If you (and I) have typed it correctly, a green check mark will appear—a red X otherwise. Fix it so you see a green check mark. Exit this. Notice it has enclosed the line in curly braces.

4e. Add the action button trait. You want it configured so pressing anywhere on the button will cause this trait to activate. For the command, enter “run”.

4f. Add a trigger trait. Erase all fields. Near the top is a bean shell field where we enter the condition of when this trigger is activated. Hit the little calculator thing and type: sum != 0 for the condition. For the trigger’s command field, enter: run. At the bottom is where you add a list of commands to be run. Click the X on the right to add a blank line. For the command, enter: error. What this does: If the user presses the button when the sum is illegal, a window will pop up with a warning message.

4g. Add another trigger and erase all fields. For the condition field, enter: sum == 0
If you don’t do this via the calc button, enclose it in curly braces.
For the trigger command enter: run.
Add two commands to this trigger: disable and delete, in that order.

What will happen: If the sum is a legal value, then the global flag will disable (false), and the button will vanish.

I almost certainly made a mistake. Let me know.
Stan

P.s. With regard to your other question, I have not done what you want, so I’d have to look it up. Perhaps someone else could respond. Myself, I’d do it with the mouseover stack viewer, and there the pilot name would need to be stored in a global property like sum or setup_enabled.

Thanks for all the tips and troubles..

.

Thank you again Shilinski, you are so patient…

I have tried it and it didn´t work so well…

But on a second thought, in this way, making the setup of a car is going to be too rigid. If a player sets up its car with a right sum and presses the button he cannot go back in its decision. Also the game rules are a “work in progress”; maybe there could be optional rules where the car set-up points will be variable.

I would prefer a more flexible solution where I could have some kind of a switch button that could go “On” and “Off”, In the “On” mode the player could change the car set up and in the “Off” mode not.

My intention is not really to forbid the players to change the gauges; only to preclude them to change inadvertently. That’s why, at the beginning I have chosen to select each gauges only with a shift+click command. But you made me much more ambitious; in this way, if a single piece controls all the changing set-up, it would be much more ellegant.

I thought that perhaps I could make it with a “Replace with other” trait. There would be a “On” piece that would have the global property that would allow all the gauges to be changed and with a menu command to replace that piece with another (the “Off” piece) that would forbid (probably with a global property also) that the gauges would be altered; it would also have a command to replace it with the “On” piece, if desired.

I have already created another global property as you told me in 1 (its named “Setup1_enabled” and not just “Setup_enabled” because I have two cars in each map window).

And I have edited all the restricted commands for each prototype piece-gauges as you told me in 2

I have made images for the switch between “on” and “off” for the two pieces that would be replaced (switched) from one another.

But, alas, my ignorance doesn’t alow me to set a proper global property in each piece with the adequate command (i.e enabling changing the gauges with the “on” piece and disabling it with the “off” piece).

Would you still have some patience left to keep instructing me? I really feel that I am beginnig to be a “pain in the ass”.

I can always go back to my first basic solution of just selecting the gauges with shift+left click, as you have already found the solutions to the real problems with the sums which were really impossible to solve without your help and knowledge, and really simplify the car set-up.

Thank you so much again…

Yours José

You are not a PITA; I don’t mind. If you followed my last message, then you have most of what you need already in place. That is, you have the “enable” global property and the restrict command changes. If you have trouble getting things to work, say so and we can help you debug.

Discard some of the stuff we added: the delete trait and, the warning dynamic property, the two triggers, but keep the new button piece. I can think of 3 ways to do this, but I will explain only one.

I am going to assume you have two buttons in your window, one to set enable/disable each car’s setup. If not, things will be a little different.

Edit a button piece. In the basic piece trait at the top, add the “on” switch image to it. Then add a layer trait. The “always active” field in it is off. Add the “off” image to it. Either change the menu command from “Activate” to “Toggle”, or eliminate it. Get rid of the control character, and replace it with the string command “toggle”.

Edit the action button trait. Change the command it executes to “toggle”.

Edit the “set global property” trait for Setup1_enabled. Change the command from “disable” to “togale”. Change the field to the far right from “false” to ‘Setup1_enabled == false”. (It is enclosed in curly braces.)

Do the same thing for the second button with Setup2_enabled.

Hopefully this works. I have not checked this for mistakes. What should happen. When you click on a switch image, the action button will cause the “toggle” command. That command will both change the image and change the enable global from true to false or false to true. If you did the restrict commands right, you won’t be able to set up a car when false. Good luck.

You are not a PITA. It’s okay.

You should two new button pieces. Keep them. Edit one. Discard the delete trait, the warning/error dynamic property, and both triggers. Edit the basic piece trait at the top. Add there the “on” image of the switch.

Edit the set global property trait for Setup1_enabled. Change the command from “disable” to toggle. On the far right, change the value field from false to Setup1_enabled==false. It will be enclosed in curly braces. This means if the toggle command is issued, Setup1_enabled will change from true to false or false to true. (Side note to me: I hope this test results in a true or false result.)

Edit the layer trait. Set the “always active” checkbox to off. Change the activate command from ^A (I think that’s what it is) to toggle, which goes to the immediate left of the control code. You can remove the “Activate” text string, or change it to maybe “Toggle.” Finally, add an image to this layer trait. Add the “off” image of the switch.

Edit the action button. Change the command it executes to toggle.

Do the same thing for your other car and Setup2_enabled.

Let me know how it goes. If it doesn’t work, tell me what’s wrong, and I will help you debug it.

Stan

| jmc3
March 14 |

  • | - |

Thank you again Shilinski, you are so patient…

I have tried it and it didn´t work so well…

But on a second thought, in this way, making the setup of a car is going to be too rigid. If a player sets up its car with a right sum and presses the button he cannot go back in its decision. Also the game rules are a “work in progress”; maybe there could be optional rules where the car set-up points will be variable.

I would prefer a more flexible solution where I could have some kind of a switch button that could go “On” and “Off”, In the “On” mode the player could change the car set up and in the “Off” mode not.

My intention is not really to forbid the players to change the gauges; only to preclude them to change inadvertently. That’s why, at the beginning I have chosen to select each gauges only with a shift+click command. But you made me much more ambitious; in this way, if a single piece controls all the changing set-up, it would be much more ellegant.

I thought that perhaps I could make it with a “Replace with other” trait. There would be a “On” piece that would have the global property that would allow all the gauges to be changed and with a menu command to replace that piece with another (the “Off” piece) that would forbid (probably with a global property also) that the gauges would be altered; it would also have a command to replace it with the “On” piece, if desired.

I have already created another global property as you told me in 1 (its named “Setup1_enabled” and not just “Setup_enabled” because I have two cars in each map window).

And I have edited all the restricted commands for each prototype piece-gauges as you told me in 2

I have made images for the switch between “on” and “off” for the two pieces that would be replaced (switched) from one another.

But, alas, my ignorance doesn’t alow me to set a proper global property in each piece with the adequate command (i.e enabling changing the gauges with the “on” piece and disabling it with the “off” piece).

Would you still have some patience left to keep instructing me? I really feel that I am beginnig to be a “pain in the ass”.

I can always go back to my first basic solution of just selecting the gauges with shift+left click, as you have already found the solutions to the real problems with the sums which were really impossible to solve without your help and knowledge, and really simplify the car set-up.

Thank you so much again…

Yours José

Hello Stan

Thanks for the precise tips but it is not working yet. The button toggles perfectly from “on” to “off” but nothing changes; with the button off the gauges keep changing.

I will try to recapitulate step by step your instructions to see if you can help where I might have goofed.

If you followed my last message, then you have most of what you need already in place. That is, you have the “enable” global property and the restrict command changes.

Ok, so I have my “enable global property” in the map window. My doubt in here is, if to set it as “true” I am writing “true” at the proper place (i.e. “initial value”). Am I??

For each prototype Gauge pieces I’ve added the restrict commands as you’ve told. I am just showing the “minus1” as an example, but there is also, of course the restrict command “plus1” in each piece.

Discard some of the stuff we added: the delete trait and, the warning dynamic property, the two triggers, but keep the new button piece. I can think of 3 ways to do this, but I will explain only one. Yes, I have discarded them.

I am going to assume you have two buttons in your window, one to set enable/disable each car’s setup. If not, things will be a little different. You are assuming right.

Edit a button piece. In the basic piece trait at the top, add the “on” switch image to it (Done). Then add a layer trait. The “always active” field in it is off. Add the “off” image to it. Either change the menu command from “Activate” to “Toggle”, or eliminate it. Get rid of the control character, and replace it with the string command “toggle”.

I have made it like this (is the string command right??? Should I have given a name to the level?):

Edit the action button trait. Change the command it executes to “toggle”.

I did it like this:

Edit the “set global property” trait for Setup1_enabled. Change the command from “disable” to “togale”. Change the field to the far right from “false” to ‘Setup1_enabled == false”. (It is enclosed in curly braces.)

I made the “set global property” like this:

Do the same thing for the second button with Setup2_enabled. (yes I know, I haven’t done it yet because I’m just experimenting with car 1).

I am sorry for all this images but probably I have goofed somewhere along the line and I am trying to show you exactly what I did. My main suspicion is at the start; I am afraid I didn´t understand well your explanation about the global property and I couldn’t manage it to make it with two levels (enabled and disabled / true / false) and the module doesn’t recognize the disabled state.

I am very sorry about my slowness and more and more indebted to you.

Yours,

José Miguel

Get rid of the quote marks in your commands. Just toggle, not “toggle”.
I put to quotes in to make sure you didn’t add extra stuff, and it turns out they had the opposite effect!

1 Like

Hooray!!!

It works, at last!

It was not only the quote marks; I had also placed curly brackets at the Global property name: { Setup1_enabled} instead of Setup1_enabled (how could I have done it?!??).

How can I ever thank you, for your patience?

I am really, really greatful to you, Stan.

yours

José Miguel

I hope you understand why it works too.

Stan

| jmc3
March 15 |

  • | - |

Hooray!!!

It works, at last!

It was not only the quote marks; I had also placed curly brackets at the Global property name: { Setup1_enabled} instead of Setup1_enabled (how could I have done it?!??).

How can I ever thank you, for your patience?

I am really, really greatful to you, Stan.

yours

José Miguel

And? You need to ask specific questions.

@shilinski The “user” you were replying to was using the tactic I see sometimes from spammers in which they ask a vague question, then come back to edit a post later to include spam links. That’s what happened here. Both that post and a subsequent one are gone and the spammer’s account deleted.