[gme-users] Interpreter (Add-On) problem setting registry value

Kevin Smyth kevin.m.smyth at gmail.com
Wed Feb 4 15:47:17 CST 2015


What version of GME are you using? There was a bug fixed in 14.10.29 that
prevented addons from getting some events.

Kevin

On Fri, Jan 23, 2015 at 6:32 AM, Florian Kraus <
florian.kraus at ils.uni-stuttgart.de> wrote:

> Hello everyone,
>
>
>
> We have an issue with GME-Interpreter working as Add-On.
>
>
>
> What we want to do:
>
> Set an Objects Registry-Value “nameColor” according to this Objects
> Attribute named “Color”.
>
>
>
> Problem:
>
> It works fine for the FIRST time, but when we change the Attribute a
> second time, nothing happens (the Interpreter doesn’t start at all).
>
> After restarting GME it works, but again just for one time.
>
>
>
> You’ll find our Interpreter-Code attached.
>
>
>
> Note:
>
> If we comment the lines where Registry is set, the Interpreter works even
> several times (but nothing happens in the model for sure).
>
> otherFCO->getRegistry()->setValueByPath("/nameColor" , "0xff0000");
>
>
>
>
>
> Any idea?
>
> Thanks in advance.
>
>
>
> Florian
>
>
>
>
>
> ---------
>
> *Dipl.-Ing. Florian Kraus*
>
> *Institut für Luftfahrtsysteme (ILS)*
>
> Universität Stuttgart
>
> Pfaffenwaldring 31
>
> 70569 Stuttgart (Vaihingen)
>
>
>
> Tel.: +49 (0)711 685-67004
>
> Fax: +49 (0)711 685-63591
>
> Email: florian.kraus at ils.uni-stuttgart.de
>
> URL: http://www.ils.uni-stuttgart.de
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ___________________________________________________________________________________
>
> Code:
>
>
>
> // ====================================================
>
> // If the component is an Add-On, then this method is called for every
> Object Event
>
>
>
> void Component::objectEventPerformed( Object& object, unsigned long event,
> VARIANT v )
>
> {
>
>        // ======================
>
>        // Insert application specific code here
>
>              std::string MetaName;
>
>              std::string InterfaceColor;
>
>              char anyChar[65];
>
>        _itoa(event, anyChar, 16);
>
>
>
>        using namespace GMEConsole;
>
>        Console::Out::WriteLine(CString("Interpreter startet") + CString("
> -  event:") + CString(anyChar));
>
>
>
>        if(event == 0x00000001){
>
>              ObjectStatus Status;
>
>              Status = object->getStatus();
>
>              if (Status == OST_Deleted){
>
>                     goto cancel;
>
>              }
>
>
>
>                     if (event == MON::OET_AttributeChanged){
>
>                            MetaName = object->getObjectMeta().name();
>
>                            Console::Out::WriteLine(MetaName.c_str());
>
>                            if (MetaName == "MyAtom" ) {
>
>                                   BON::FCO otherFCO(object);
>
>                                   InterfaceColor = otherFCO->getAttribute(
> "Color")->getStringValue();
>
>                                   if (InterfaceColor == "RED") {
>
>
> otherFCO->getRegistry()->setValueByPath("/nameColor" , "0xff0000");
>
>                                   }
>
>                                   if (InterfaceColor == "YELLOW") {
>
>
> otherFCO->getRegistry()->setValueByPath("/nameColor" , "0xffff00");
>
>                                   }
>
>                                   if (InterfaceColor == "BLUE") {
>
>
> otherFCO->getRegistry()->setValueByPath("/nameColor" , "0x0000ff");
>
>                                   }
>
>                            }
>
>
>
>                     }
>
>
>
> cancel:
>
> Console::Out::WriteLine(CString("Interpreter stopped"));
>
>
>
>
>
>        }
>
>
>
> }
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> gme-users mailing list
> gme-users at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20150204/2fd69be0/attachment.html 


More information about the gme-users mailing list