Custom parameter type for variables

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #61963 quote
    Asedubelin
    Participant
    Junior

    If I add a parameter in my code I can choose if it is integer, decimal, boolean or MM type.
    Is it possible to have a parameter which value is selectable among 2 or more defined value in a window, in the same manner as MM type (but other values and not simple, exponential, …)?

    #61966 quote
    Nicolas
    Keymaster
    Master

    It’s not possible since variables can only handle numbers and not strings. There’s no way to determine external parameters by code (I’d like to!), but you can only add them manually in the variables window.

    #61970 quote
    Asedubelin
    Participant
    Junior

    Yes, I know that variables can only handle numbers and not strings, in fact in MM type choosing “simple” the variable becomes 0, choosing “exponential” the variable becomes 1 and so on.

    I would want to have the possibility that choosing “my first choice” the variable becomes 0, choosing “my second choice” the variable becomes 1 and so on.
    is it possible to change the text displayed in MM type variable window?

    #61972 quote
    Nicolas
    Keymaster
    Master

    It is not possible to change the text in the variable window.

    However, you can set an integer variable, named “var1” for example and do the following to select different choice:

    if var1 = 0 then 
     // do something 
    elsif var1 = 1 then 
     // do something else 
    // ..... etc with 2,3,4, ....
    endif
    #61974 quote
    Asedubelin
    Participant
    Junior

    Yes, but people, that use my indicator and can’t read the code, have not the possibility to associate 0, 1, … value with the behaviour of the indicator.
    I must explain in an external files what 0, 1, 2, … means

    #61999 quote
    Nicolas
    Keymaster
    Master

    Then you should make a nice colorful PDF documentation to explain it 😉

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Custom parameter type for variables


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Asedubelin @asedubelin Participant
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by Nicolas
8 years ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 02/08/2018
Status: Active
Attachments: No files
Logo Logo
Loading...