Page 1 of 1

Using SetFlag and AddFlagOrder

Posted: Tue Jul 17, 2007 4:34 am
by Jaguar_jwg
I have a problem with a script not working.
I have two pawns. One as a button, and one as a platform.
When the player clicks on the button with the mouse, the platform is supposed to move to a point and then return.
I have two ScriptPoint entities. One at the point the platform goes to, and the other where it returns.
When I click on the button, the platform moves to the first point (ScriptPoint1), but it stops there and does not return (scriptPoint2).

In ScriptPoint1 szEntityName I have DesPointA, and in the NextPoint I have HomePointA.
In ScriptPoint2 szEntityName I have HomePointA.
In the script for the button I have:
Spawn[()
{
Console(true);
HideFromRadar(true);
Gravity(true);
LowLevel("SelectEntityByMouse");
}]

SelectEntityByMouse[()
{
if(self.lbutton_pressed)
{
SetFlag(1, true); //Start up PlatformA to move
}]
}

Then in the script for the platform I have:
{

Spawn[()
{
HideFromRadar(true);
Gravity(false);
AddFlagOrder(1, true, "ActivateDiscA");
}]

ActivateDiscA[()
{
RotateToPlayer("", 60, false, "");
MoveToPoint("", 30, "my_sounds\\transfer.wav");
NewOrder("Home");
}]

Home[()
{
NextPoint();
MoveToPoint("", 30, "my_sounds\\transfer.wav");
Delay("", 10, "");
}]
}

I don't see anything in the console to show me why the platform is not moving to the second point. Can anyone help me out please?

Posted: Tue Jul 17, 2007 7:14 am
by WebsterX37
Hello Jaguar, just one question (I am new to scripting RF):

Is it possible to use a flag defined in one pawn script, to be used be another pawn? I dont think so. I think the flag is only seen by the pawn the flag was set for. It can't be used by the other pawn. Am I right? If, then u could use a trigger within
the level with triggerstate set by the first pawn.

Posted: Tue Jul 17, 2007 4:44 pm
by Jaguar_jwg
I was using the rfscriptingv1 demo that came with RF. In the scripting_virgil script it has:
SetFlag(1, true); //Start up Rob to walk in
NewOrder("WaitForRob");
}]

WaitForRob[()
{
AddFlagOrder(2, true, "RobCompletedWalking"); // Rob completed walking in
RestartOrder();
}]

Then in the scripting_robot script it has:
Spawn[()
{
// Console(true);
BoxWidth(10);
AddFlagOrder(1, true, "StartWalking");
}]

StartWalking[()
{
MoveForward(WALK, SPEED, 45, "");
RotateMove(WALK, SPEED, SPEED, 0, 40, 0, "");
ShowText(1, "Rob", "", "Hello,<CR>My name is Rob Ot.", FONT,"", 0, -150, "right", 255);
MoveForward("", SPEED, 100, "");
RemoveText(1);
RotateMove(WALK, SPEED, SPEED, 0, 70, 0, "");
NewOrder("ProgressWalking");

}]

ProgressWalking[()
{
ShowTextDelay(1, "Rob", IDLE, "I'm supporting Nout to show this demo", FONT, 2, "", 10, -160, "right", 255);
SetFlag(2, true);
ShowTextDelay(9, "Nout", "Idle", "Now we animate some attributes!", FONT, 2, "", 10, -160, "left", 255);
LowLevel("AnimateAttributes");
}]

I think it works. In fact mine worked. The platform moved.
It's just that it may require specific code to get it to continue, which I can't figure out.