PDA

View Full Version : CallCommand(?) Number differs/changes


tcastudios
04-18-2007, 12:54 PM
When I try to incooperate CallCommands() in my scripts I check what CallCommand number I should use in the CommandManager.
However, some "Default" CallCommads are scripts that seems not to be "hardwired".
I.e "AddSpotLight" have a "6000000xx" number.
The thing is that thoose last xx differ at different times!
I wrote a script yesterday and it was "600000098" and to day it didn't work
since in the CommandManager ,today, says it should be "600000099"

I have stumbled into this before but thought I must be doing something strange and didn't
have time to check what was happening.

To doublechecked I see that on another machine, today the same CallCommand should be
"600000094"!

Why are -some- of the default commands "floating" scripts".

It also means that my own scripts will/could change their CallCommand numbers on each restart of the computer.
Wouldn't it be good to have at least your own scripts given a "locked" number on the same machine?

Cheers
Lennart

sandidolsak
04-18-2007, 02:34 PM
now thats wierd, here its 600000017 =)
dunno why, but i would do this by comparing in a loop...

var i=1;
while(i<100)
{
if (GetCommandName(600000000+i)=="Spot Light") CallCommand(600000000+i);
i++;
}
if there is no other option to lock it :)

tcastudios
04-18-2007, 02:40 PM
That's cool!
I'll try that and hopefully the scripting will be concistent thruout nested CallCommands
and it might be possible to actually share them safely.

Thanks
Lennart

JDP
04-18-2007, 03:46 PM
In the case of lights CallCommand(5102) will always create an Omni, then use the following code in the script;

CallCommand(5102);

var op=doc->GetActiveObject();
if (op)
{
op#LIGHT_TYPE = LIGHT_TYPE_SPOT;
}

This is exactly how it's done by C4D.

Regards,
JDP

tcastudios
04-18-2007, 03:54 PM
Thanks JDP.
That's how I ended up with this particular script.(Making it sort of "fully" COFFEE)
It is just strange, since using CallComands the script was like 8 lines all in all and
Undo is automatically included (as I understand it).

It now got 4 or 5 times bigger ,no problem "technically" but it somehow defeats
the purpose of using your own (and default)nested scripts more casually.
Plus you have to take care of all Undos as well.


Cheers
Lennart

c-montesano
04-19-2007, 03:49 PM
The commands that begin like "6000000xx" are coffee scripts, which appear to be numbered dynamically... so hard coding the numbers is pointless. This is probably to avoid having to obtain a unique plugin id for every script created.

The actual script for adding a spot light is located in "resource\scripts".

But yeah, it would be nice if there was a reliable way to call your own scripts from code.

-Chris

CGTalk Moderation
04-19-2007, 03:49 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.