Author Topic: User variable´s scope  (Read 1526 times)

Tags:
  • All members
  • Posts: 211
User variable´s scope
« on: 07 Feb 2020, 02:32 »
Hi,

I am facing some problems with user variables.

I created an user variable with the scope "individually for each event". Meanwhile i've noticed that if i delete the market where the user variable was set and then i restart that same market, the user variable "may" assume a value set in a different event.

"May" because if i delete markets on 2 events, when i restart the 2,  both assume the value set previously (before erasure) of one of them.

Is that an expected behavior?
If it is, what can i do to avoid it?

thanks

  • Administrator
  • Posts: 8826
  • Gender: Female
*
Re: User variable´s scope
« Reply #1 on: 09 Feb 2020, 15:14 »
Hello!

No, if you have set a variable in a certain market with a scope of the current event, its value will never be changed to that from another event, even if you delete the market where it has been set. This is not an expected behaviour.

How did you arrive at this conclusion? Did you watch the View Variables window and thus saw the value of the variable change?
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Join our WhatsApp chat!

Присоединяйтесь к официальному Telegram-каналу!

  • All members
  • Posts: 211
Re: User variable´s scope
« Reply #2 on: 10 Feb 2020, 05:59 »
Hi Oxa,


After some hours diving on the logs, i think, i discovered what happened. 

I found out that the problem only happened when i attached to the user variable "_event_id". 

So, when i deleted markets and restarted the markets with an user variable "team.qlt" everything run ok. After the restart of the markets, the trigger run again and gave me a new value for each market.


When i used a variable "team.qlt_event_id", the behavior was different. In this case after the restart, MFPro assumed that there was already an user variable and, as one of the conditions was that the variable was equal to the initial condition (zero), it didn´t chose new values.

I send you in attachment a print with logs on the 2 matches.

As you can see:

01:39:58-(UV-2) the user variable is set to 0.00179646 on the "Union Santa Fé v Atlético MG" match.

01:50:23-(UV-1) the user variable is set to 0.00732143 on the "millionarios v always ready" match.

01:52:18-(UV-1) "Union Santa Fé v Atlético MG" is restarted (match_minute=0 in the 1st refresh). User variable changes to the value it assumes in the other match (0.00732143).             

01:55:30-(UV-2) both market are restarted (match_minute=0 in the 1st refresh). Due to the condition mentioned before, it maintains in both markets the value of the user variable (0.00732143-set on "millionarios v always ready").

I guess this time you will, probably, say that´s the expected behavior :):):)

Thanks

  • Administrator
  • Posts: 8826
  • Gender: Female
*
Re: User variable´s scope
« Reply #3 on: 11 Feb 2020, 21:45 »
Quote
I found out that the problem only happened when i attached to the user variable "_event_id". 

User variables are the first in the parsing order when the program evaluates trigger expressions. For this reason, you should never include any other trigger variables (either constants, variables created by you or any other system variables) into the names of user variables, for they will be evaluated incorrectly. This is actually stated in the manual, chapter "Variables - Order of parsing variables":

Quote
So, trigger expressions are parsed in this order.

1. User variables and Constants. For this reason you cannot include any other variable in the name of a user defined variable when executing a trigger with the "set user variable" action.

2. Market variables starting with the winplace_ prefix.

3. Win/Lose History variables.

4. General Variables.

5. Matching Selection Variables.

6. Market variables starting with the mr_ prefix.

7. Market Variables and Market Prefixes.

8. Selection variables starting with the prefixes s_, r_ and pw_.

9. Remembered Selections variables.

10. Selection Variables.

11. Excel-Bound Variables.

12. Operators and functions.

You should find another solution that does not involve adding event_id to the name of your variable.
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Join our WhatsApp chat!

Присоединяйтесь к официальному Telegram-каналу!

  • All members
  • Posts: 211
User variable´s scope
« Reply #4 on: 12 Feb 2020, 03:04 »
Hi again Oxa,

You were quite enlightening.

I am however with another problem still related with this subject.

I am making a very basic trigger to delete inactive markets. For that i defined a variable with the scope "individually for each event". However when i use it, it works like it is being set with a wider scope. I mean, the value of the user variable set in 1 event was assumed in all the other events. Therefore all markets in the different events were deleted.

I am certainly doing something quite wrong, but i can´t find out what. 

I send the trigger attached, if you or someone else, can take a look i would be very grateful.

When testing, the condition"....market_score2 is equal to..." should be changed to adapt to a result in progress.

Thanks

  • Administrator
  • Posts: 8826
  • Gender: Female
*
Re: User variable´s scope
« Reply #5 on: 12 Feb 2020, 14:51 »
Could you explain in plain English on what conditions should a market be deleted? From what I can see, you are trying to delete a market when there are at least 20 events where the second team's score is equal to 3?
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Join our WhatsApp chat!

Присоединяйтесь к официальному Telegram-каналу!

  • All members
  • Posts: 211
Re: User variable´s scope
« Reply #6 on: 12 Feb 2020, 17:21 »
Could you explain in plain English on what conditions should a market be deleted? From what I can see, you are trying to delete a market when there are at least 20 events where the second team's score is equal to 3?
These are not the original conditions. I changed them because, at the late time i was checking it, there were almost no matches inplay and the original conditions were too demanding and not as frequent as required to "trigger it". So, to confirm the results, i had to change the conditions to something that could use the result of a match in progress. The match i used had the time displayed and the result was 0-3. I had, therefore, to change the conditions to match_minute >0 and market_score2 =3 to be able to fire the trigger.

The question here is that with both the original conditions, at a earlier time of the day, and with these, at a later time, the result i obtained was the same. When the user variable assumed the demanded value (21 in this case) in just 1 event , all active markets were deleted, no matter the event they belonged to.

Describing better the original trigger:

Intention: to delete a market when the event is inplay at betfair, but both score and time are not being shown. I noticed this in several matches yesterday.

Implementation: 2 triggers: 1 to define the user variable (inactive markets) and the 2nd one to delete the market.

Conditions: inactive markets: "selection´s trigger expression match_minute is equal to zero" and "selection´s trigger expression ,market_score1 is less than 0". This set the user variable "inactive.market". Each time the user variable is set, it adds 1 to its previous value.
delete market: "selection´s trigger expression inactive.market is greater than 20". The conditions to set the user variable "inactive.market" force me to use the condition "inactive.market > 20". At inplay, in the 1st refreshes, after the market is imported by the market locator, both score and time are not displayed by the program (assume match_minute=0.00 and market_score1=-1). So, the user variable will always be fired several times, even in a normal active market. That´s why i had to use a greater value. To give a margin to avoid these situations.

I send you the original trigger in attachment.

I hope this time i could have been more explicited. Sorry about the big post, but i guess it was needed.

Thanks

  • All members
  • Posts: 211
Re: User variable´s scope
« Reply #7 on: 12 Feb 2020, 22:54 »
Hi again,

I solved the problem.

As expected it was a very bacic error derived from my lack of knowledges about the mechanics of MFPro.

According to the MFPro manual, page 84 "All Constants have the "Global" scope". So, when i created the constant to give it an initial value, it seems the global scope overlapped the scope defined when set the user variable.

I send attached the original trigger with the corrections i made for anyone interested.

Thanks :):):)

  • Administrator
  • Posts: 8826
  • Gender: Female
*
Re: User variable´s scope
« Reply #8 on: 26 Feb 2020, 10:12 »
Thank you so much for sharing your knowledge, BlueSky, it is always appreciated around here!
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Join our WhatsApp chat!

Присоединяйтесь к официальному Telegram-каналу!

 

Please note, BetFair is seems to be currently OFFLINE