Help with tutorial

ronaldace

Spaceman
Hello! Been trying to follow the tutorial (thanx to the author, by the way ;) ) but found trouble when compiling the tistr.pas file (in tutorial 2). When I hit compile, I got the following in the output window:

[, 1]ERROR: expected "unit" but found "#"
[, 1] raised in , line 0 (call stack: < < < )

Also, the first line (#SetOutput......) turns red.

How to do to get past this? Just when the tut was getting interesting... :D

Thanx in advance!
 
It looks like you've skipped a line. The first line in all WCPPas source files must be the line that tells WCPPas which kind of file this is going to be (That's what it meant when it said "expected unit...").

In the case of a mission, you should add this before the #SetOutput... line:

mission s0;

(Don't forget the semi colon) This tells WCPPas to compile this mission under the filename "s0.mis", which is what WCP calls the simulator's first mission... so after you're done with this, just choose the sim's first mission to test what you've just created.

Hope that helps :)
 
Thanks! But I didn't miss the line.. the file with the problem is the one in the tutorial2.zip file, located in the tutorial section of this web. I'm just supposed to compile it, not make it myself. It has something to do with the target strings. (meaning, since it's not a normal mission I don't know what is missing).
 
Oh, sorry, I didn't realize you were talking about the string file.
I've just downloaded the file to take a look at it... and indeed it does give an error. I've never tried setting the output path in an IFF file, so I don't know if there's any way to fix that, but this should definitely work: delete that first line from the file, and just manually copy it to the language folder inside your WCSO folder :D
 
Thanks! that did it. :D

Now there's another problem: When I hit compile, it looks for the targetid.eng file in the same folder as the mission source file (the .pas). It doesn't search for it in the secret ops\language folder. Is this normal?
 
It is normal, unless you tell WCPPas that you don't want it to happen ;)
Add this line to your mission somewhere in the beggining of the file (right after the "mission s0;" line should work):

#AddToSearchPath ("$wcso$\language");

This will tell WCPPas to look for files in that folder as well.
 
Yeah. For any paths outside of the main SO folder or the source folder, you need to put in a declaration. For example...

#AddToSearchPath ("$wcso$\language");
 
Right. Got it. ;)

I must be tiring u guys, but got another question. I've almost finished the mission of Tutorial 2, but I have a problem when trying to make the Midway dissapear from the radar when I go to Nav 2. I try to use "SF_BindToActionSphere(1);" in the Midway's main function, but when I start the mission the game closes and I get the following message:

"AIQ::removeFromAIQ remove called on control not in list."

How can I make it dissapear?

Also, to make the mission finish, I set the following as the death function for the Morays:

function D_Spawn;
begin
aliensalive := aliensalive - 1;
if(aliensalive = 0) then begin
SF_SetMissionSuccess;
AI_WaitSeconds(5);
SF_Exit;
end;
end;

I get the mission success, but it doesn't end..

Man this is making me crazy....... I like that! :D
 
Ronald it may be easier to just use

M_WaitUntilDead;
AI_WaitSeconds(5);
SF_Exit

in the nav function

P.S. SF_Exit has to be inside the nav function
 
yaaaay! That did it! The mission finally ends! :D :D :D

Now the only problem I have is making the Midway disappear when I'm at Nav 2 (check my previous post here). Any tips?

Thanks a lot for your help so far! ;)
 
How are you activating the Midway? If you're using SF_ActivateSelf(0); then that might be your problem. It's hard to tell without knowing exactly how the mission should work (does the Midway appear right from the start? Does it autopilot with the player? etc), and I don't remember this too well, but I'll give it a try:

Instead of "SF_ActivateSelf(0)" in the Midway's main function, use this:

AI_WaitUntilActive;

Then, in the function of the navpoint you want the ship to appear in, create a "setup" variable. This variable is used to keep some events from happening over and over again, and is usually a good thing to have. In this example, it tells the game to only activate the Midway once (not sure if it was necessary in this case). Anyway, here's how your nav point function should start:

function M_NAV2;
var setup = true;
begin
while(1) do begin
if (NAV_WithinSphere(Player)) then begin
NAV_ActivateSelf;
if (setup) then begin
SF_ActivateObject(Midway,0);
setup := false;
end;
(etc...)

Notice that you're now activating the Midway only when the player is in this Nav point, and that the setup variable prevents this from happening over and over again until the player leaves this nav point. When the player moves to each new nav point, anything that was assigned to an actionsphere that is now inactive will automatically get deactivated as well. The trick is not activating things that only show up in certain navpoints with the "SF_ActivateSelf" command.

Hope that helps (but this time I'm not sure if it will :p) I've not read Pedro's tutorials so maybe he already covered all of this in there, and your error might be related to a different thing altogether... but that's the only thing I could think of without actually seeing the mission's code.
 
Well here is a problem. I have created a mission with 2 navs and the Midway will not even appear. So where did you put your Midway Actiavteself at? If I can get the Midway to appear than I should be able to help you. This wasn't any help in my situation, what about you Ronald?

mission s0;

#include wcp, consts, pilots, utils;
#strings targetid;
#SetOutputPath("$wcso$\mission\");

object Nav1(Navpoint)
x:0;
y:0;
z:0;
main: M_Nav1;
navdata: 1, 5000;
end;

object Nav2(Navpoint)
x:10000;
y:10000;
z:10000;
main: M_Nav2;
targstr: targetid["Nav_2"];
navdata: 1, 5000;
end;

object Nav3(Navpoint)
x:20000;
y:20000;
z:20000;
main: M_Nav3;
navdata: 1, 5000;
end;

object Player(Player)
obj: panthrbl;
x: 0;
y: 100;
z: 0;
main: M_Player;
pilot: PILOT_Casey1;
targstr: targetid["Alpha 1"];
end;

object Midway(Capship)
obj: Midway;
x: 0;
y: 0;
z: 0;
main: M_Midway;
pilot: PILOT_TCS_Midway;
direction: 0, 0, 0;
targstr: targetid["Midway"];
end;

function M_Player;
begin
SF_SetObjectFlag (OF_alignment,ALIGN_Confed);
SF_ActivateSelf(0);
SF_PlayerSwitchToCam(CamID_cockpit, Player);
while(1) do
AI_WaitSeconds(1);
end;

function M_Midway;
begin
SF_SetObjectFlag (OF_alignment,ALIGN_Confed);
SF_BindToActionSphere(1); // this means the first nav point
AI_WaitUntilActive;
while(1) do begin
AI_WaitSeconds(1);
end;
end;


function M_Nav1;
var setup = true;
begin
while(1) do begin
if (NAV_WithinSphere(Player)) then begin
NAV_ActivateSelf;
if (setup) then begin
SF_ActivateObject(Midway,0);
setup := false;
end;
NAV_SetPlayerNav(2);
while(NAV_WithinSphere(Player)) do begin
AI_WaitSeconds(1);
end;
NAV_DeactivateSelf;
end;
AI_WaitSeconds(1);
end;
end;

function M_Nav2;
var
setup = true;
begin
while(1) do begin
if (NAV_WithinSphere(Player)) then begin
NAV_ActivateSelf;
setup := false;
end;
NAV_SetPlayerNav(3);
while(NAV_WithinSphere(Player)) do begin
AI_WaitSeconds(1);
end;
NAV_DeactivateSelf;
end;
AI_WaitSeconds(1);
end;

function M_Nav3;
var
setup = true;
begin
while(1) do begin
if (NAV_WithinSphere(Player)) then begin
NAV_ActivateSelf;
setup := false;
end;
NAV_SetPlayerNav(1);
while(NAV_WithinSphere(Player)) do begin
AI_WaitSeconds(1);
end;
NAV_DeactivateSelf;
end;
AI_WaitSeconds(1);
end;

function MAIN;
begin
MS_RunSpaceFlight(0);
end;
 
You've forgotten to bind the midway to an actionsphere.

function M_Midway;
begin
SF_SetObjectFlag (OF_alignment,ALIGN_Confed);
SF_BindToActionSphere(1); // this means the first nav point
AI_WaitUntilActive;
while(1) do begin
AI_WaitSeconds(1);
end;
end;

And in M_NAV1, right above the line where you wrote "I guess this is the right location", add this line:

if (setup) then begin

(You need to check wheter setup is true before activating the Midway, otherwise it will just run that bit of code over and over again like there was no setup variable at all)
 
I think I got it. You've misplaced the "NAV_SetPlayerNav(2);" line. Try placing it below the "while(NAV_WhitinSphere...)" line, not above it. You should end up with something like this:

function M_NAV1;
var
setup = true;
begin
while(1) do begin
if (NAV_WithinSphere(Player)) then begin
NAV_ActivateSelf;
if (setup) then begin
SF_ActivateObject(Midway,0);
setup := false;
end;
while(NAV_WithinSphere(Player)) do begin
NAV_SetPlayerNav(2);
AI_WaitSeconds(1);
end;
NAV_DeactivateSelf;
end;
AI_WaitSeconds(1);
end;
end;
 
No idea, then. I copied that function from one of Standoff's missions (cutting out the extra stuff it had), so it should work.
Bah, where is Quarto when you need him? Damn Australian timezones. :p
 
Probably asleep being that it is dead night where he is. At least who are up, BTW, what timezone are you in: East or Central?
 
Back
Top