Results 1 to 4 of 4

Thread: Menu Function - origin problem

  1. #1
    Private First Class RobsoN's Avatar
    Join Date
    Jan 2013
    Location
    /home/cod2/
    Posts
    230
    Thanks
    119
    Thanked 95 Times in 64 Posts

    Menu Function - origin problem

    Hello, I used this tutorials for menu functions.

    I've got error like that:
    Click image for larger version. 

Name:	shot0066.jpg 
Views:	24 
Size:	28.0 KB 
ID:	328

    It's something bad with first argument.
    Line in error message (185) is this line:
    PHP Code:
    BUTTON_TITLE(ORIGIN_TITLE_1"robson_title_locked""ui_robson_list_1""-2"); 
    And the function:

    PHP Code:

    #define ORIGIN_TITLE_1 220 130
    #define ORIGIN_TITLE_2 220 190
    #define ORIGIN_TITLE_3 220 250
    #define ORIGIN_TITLE_4 220 310

    #define ORIGIN_TITLE_5 420 130
    #define ORIGIN_TITLE_6 420 190
    #define ORIGIN_TITLE_7 420 250
    #define ORIGIN_TITLE_8 420 310

    #define BUTTON_TITLE(_origin, _image, _dvartest, _id) \
    itemDef \
    { \
        
    name            "titles" \
        
    origin            _origin \
        
    visible            1 \
        
    rect            0 0 128 32 \
        
    forecolor        GLOBAL_UNFOCUSED_COLOR \
        
    type            ITEM_TYPE_BUTTON \
        
    style            WINDOW_STYLE_SHADER \
        
    background        _image \
        
    dvartest        _dvartest \
        
    showDvar        "title_" ## _id } \
        
    mouseEnter \
        { \
            
    play "mouse_over"; \
        } \
        
    action \
        { \
            
    play "mouse_click"; \
            
    scriptmenuresponse "select_" ## _id; \
        
    } \

    I tried aslo

    PHP Code:
    BUTTON_TITLE(220 130"robson_title_locked""ui_robson_list_1""-2"); 
    but still got error.

    Thanks for help.

  2. #2
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Please try to add this for "rect":

    HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN


    Like:

    PHP Code:
        rect            0 0 128 32   HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN 
    You can also use a macro in a macro. First declare it over your current macro:

    PHP Code:
            #define RECT(_rect_) \
                
    rect _rect_ HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN 
    So you can rewrite the failing line like:
    PHP Code:
        RECT(0 0 128 32) \ 
    timescale 0.01

  3. The Following User Says Thank You to kung foo man For This Useful Post:

    RobsoN (4th July 2013)

  4. #3
    Private First Class RobsoN's Avatar
    Join Date
    Jan 2013
    Location
    /home/cod2/
    Posts
    230
    Thanks
    119
    Thanked 95 Times in 64 Posts
    So much respect for you mate!

    I aslo found my mistake in ';' and rect should be above origin.

    Macros rocks!

  5. The Following User Says Thank You to RobsoN For This Useful Post:

    kung foo man (4th July 2013)

  6. #4
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    I posted about this - when using macros, all rectangles must have 6 parameters and not the usual 4. Otherwise, the game wont parse them properly, and it starts to read other parameters as part of the rectangle. Hence, why the error was telling you that it was expecting an integer but found "forecolor" instead - it was reading the next line down as part of the rectangle.

  7. The Following User Says Thank You to Tally For This Useful Post:

    RobsoN (4th July 2013)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •