Notification message with parameters

  • Hello,


    I'm trying to display a notify message with two parameters (for instance - string and an int)

    Code
    DECL CHAR msg[80]
    DECL INT num
    num = 20
    msg[] = "Gripper"

    To at the end display something like:

    • Your msg[] was mounted correctly in physical connection num
    • Your Gripper was mounted correctly in physical connection 20

    I tried to use the "msglib" library but no success. Is there anything I'm missing?

  • Well, why don't you use Swrite to create a complete string you want displayed and use that as a parameter for any of the MsgLib functions? If you are this new to programing in general, I suggest first learning some C or Pascal (or some other simple language with strong typing) to understand some basics. KRL is bad as a first programing language :smiling_face:

  • Well, why don't you use Swrite to create a complete string you want displayed and use that as a parameter for any of the MsgLib functions? If you are this new to programing in general, I suggest first learning some C or Pascal (or some other simple language with strong typing) to understand some basics. KRL is bad as a first programing language :smiling_face:

    Mentat,

    Thanks for your answer. I'm actually not a beginner in the programming world. I've used multiple languages including C professionally.

    I've used KRL for some time already but I still haven't find out the best way to display notifications messages in KRL. In fact, I've thought already about creating a complete string and display it but thought that it was a really weird way to do stuff. If there's any other way, I'd be glad to get to know it!


    Anyway, thank you for your answers guys. Have a nice evening/day!

  • for someone that used C, why would you want any other way? and why would this be weird?

    you can use Set_KrlMsg() or MsgLib (which is just a wrapper for Set_KrlMsg() function)


    if you choose Set_KrlMsg() it supports up to 3 embedded parameters (officially), so this can work for your needs.

    MsgLib() allows one embedded parameter as most commonly used form so without resorting to SWRITE or similar you are stuck.

    if you use SWRITE() you can insert several parameters and then pass the result to one of MsgLib subs. using SWRITE is very similar to C.

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

Advertising from our partners