Greetings,
I have (hopefully) an easy question I need help with. I’m testing “My Deamon” URCaps, and I have managed to modify the hello-world.py in a way that it saves data in a text file. Right now it only saves the name typed in the “My Deamon” URCap. Now that it saves data (typed name) periodically to the text file, I’m planning to implement some Variable values as well.
I just can’t figure out where I need update the values so the string send to the deamon is updated every robot program cycle. Below is my generateScript(), and with it I can send values from the integer CustomValue00, but it seems “CustomValue00++;” is run only once when I start the robot program. Stopping and restarting the robot program increases the value of CustomValue00, so I can only see the “CustomValue++” is run when the program runs the first loop. Is it so that generateScript() is run only once and then the script generated by it is repeated every time that URCap is called from the robot program? And if so, what is the correct place to update any values every time the URCap is called?
A simple example that would help me a lot would be code for a program that popups a message and every time the value in the message would increase.
Thank you in advance for any tips!
@Override
public void generateScript(ScriptWriter writer) {
CustomValue00++;
writer.assign("mydaemon_message", getInstallation().getXMLRPCVariable() + ".get_message(\"" + getName() + CustomValue00 + "\")");
writer.assign("mydaemon_title", getInstallation().getXMLRPCVariable() + ".get_title()");
writer.writeChildren();
}