Can't build a bot with a program passed as a string #938
Comments
|
Be sure your program has an 'extern' function. It would be nice if there were shortcuts like: It would good if %lvl%, %cat%, and %chap% work with .factory() too. |
|
@melex750 , thanks for the help. |
|
I can only think it might be a compile error or an error that stops the program. extern void object::Test()
{
string prog = "extern void object::ProgramString()\n";
prog += "{\n";
prog += " while(this.energyCell == null) wait(1);\n"; // wait for a battery
prog += " message(\"Hello World!\");\n";
prog += "}\n";
object botFactory = radar(BotFactory);
botFactory.factory(WheeledGrabber, prog);
}You can open the debugger during a code battle by: |
|
@melex750 , thanks for looking into it. |
|
I was able to reproduce this, it is basically a bug in Bot Factory code. If the string passed to |
|
@melex750 good catch, I didn't really realize that the string argument may contain more than one line :P |
When a bot built with a firmware loaded from external file its program doesn't start.
Script sample:
I tried the sample
Shooterscript from the very basic solution: the program runs fine if it is included in the script of the building grabber (so the code is likeit.factory(type, "Shooter"), and same program doesn't start if it is loaded into the new bot from an external file.Code battle mode with version 0.1.9 (Windows 7 64-bit).
The text was updated successfully, but these errors were encountered: