Lord_Grismath
05-30-2002, 12:47 PM
Grismath here, with yet another cog problem.
I downloaded and ran ParSec on this, and it did pick up quite a few smaller errors, as well as picking up some MotS commands (this is for MotS) as errors.
There is, however, the main, and more serious error of the cog not running at all (well, at least not WORKING), and the fact that when adj1 is passed, the game crashes and returns to Windows.
Without further ado, my latest dysfunctional brainchild...
# Rites of Xanthus TC Cog Script
# Mysteries of the Sith
#
# Infinity.COG
# 5.30.02
# -by Lord_Grismath (GrismathDynasty@hotmail.com)
#
# Description:
#
#
# Instruction:
#
# Simply create your level without any regard to thing count (but keep
# hallways and doors to about 200). Then place this cog every two rooms,
# define all your Things and their Templates, and then delete the things.
# Run the level and voila, dynamically created Things based on the player's
# location.
#
# Set it up like so:
#
# Infinity Cog (starter) *end of 1st cog* Infinity Cog...
# sec0 adj1 dadj1 |
# [rm0] -- | -- | -- [rm1] -- | - * - | -- [rm0]...
# dadj0 sec1 (adj0 of next cog)
#
#
# ** POINTS OF INTEREST AND EDITATION **
# (i.e. the numbers with the stars in front of them)
#
# 1. TakeSector, :P, I'm thinking that I'll have to send Genesis to
# each individual pos vector, as there could (and probably will be)
# more than one sector in the room. :[ This is, btw, dynamically
# updated.
#
#
#
# 4. adj1 has been removed for redundancy issues. It is controlled
# by adj0 of the next cog. Thing genesis has been removed for the
# same reason.
#
#
# This Cog is Not supported by LucasArts Entertainment Co
symbols
message startup
message crossed
message user0
int starter=0 // Is this the first cog in the set? (1=Yes/0=No)
int ender=0 // Is this the last cog in the set? (1=Yes/0=No)
int sec0=0 local // Whether or not room 0 is loaded.
int sec1=0 local // The same for room 1
int flag=80 local // * NOTE: Check to see if this hex conversion is correct :P
surface adj0 // These adjoins load the rooms beyond *4
surface adj1
surface dadj0 // In case the player wants to go back
surface dadj1
sector tsec local // *1 - TakeSector, the sector in which the things are created
thing a0 local // *2 - The dynamically created Things. 50 per room.
thing a1 local // 'a'-'e' for room 0, and 'f'-'k' for room 1.
thing a2 local
thing a3 local
thing a4 local
thing a5 local
thing a6 local
thing a7 local
thing a8 local
thing a9 local
vector pa0 // World positional vectors for the dynamic things.
vector pa1
vector pa2
vector pa3
vector pa4
vector pa5
vector pa6
vector pa7
vector pa8
vector pa9
vector la0 // Look vectors for the things.
vector la1
vector la2
vector la3
vector la4
vector la5
vector la6
vector la7
vector la8
vector la9
template ta0 // Templates for the things.
template ta1
template ta2
template ta3
template ta4
template ta5
template ta6
template ta7
template ta8
template ta9
thing f0 local // *3 - Room 1's Things. (10 , 'f' only, for now)
thing f1 local // 'f'-'e' for room 0, and 'f'-'f' for room 1.
thing f2 local
thing f3 local
thing f4 local
thing f5 local
thing f6 local
thing f7 local
thing f8 local
thing f9 local
vector pf0 // World positional vectors for the dynamic things.
vector pf1
vector pf2
vector pf3
vector pf4
vector pf5
vector pf6
vector pf7
vector pf8
vector pf9
vector lf0 // Look vectors for the things.
vector lf1
vector lf2
vector lf3
vector lf4
vector lf5
vector lf6
vector lf7
vector lf8
vector lf9
template tf0 // Templates for the things.
template tf1
template tf2
template tf3
template tf4
template tf5
template tf6
template tf7
template tf8
template tf9
cog infmaster_cog
int devmode=0 local
int X=0 local
thing player local
end
# ================================================== ======================================
code
# .................................................. ......................................
killflagged:
For(X=0; X<=GetThingCount(); X=X+1) {
if(GetThingFlags(X) == flag) {
DestroyThing(X);
}
}
// Destroys things generated by this cog, i.e. with the defined flag.
return;
# .................................................. ......................................
startup:
player=GetLocalPlayerThing();
if(starter == 1) {
// Clean the slate of any flagged objects just in case.
call killflagged;
For(X=0; X<10; X=X+1) {
Create the things for room 0.
tsec = FindSectorAtPos(pa[X]);
a0[X] = CreateThingAtPos(ta[X], tsec, pa[X], la[X]);
SetThingFlags(a0[X], flag);
}
// Only set the variable AFTER the things have been created. :]
sec0 = 1;
if(devmode==1) {
print("Starting Room Initialised.");
}
}
return;
# .................................................. ......................................
user0:
//Sent from the infmaster.cog
devmode=1;
SendMessage(infmaster_cog, user0);
if(ender == 1) {
SendMessage(infmaster_cog, user1);
}
return;
# .................................................. ......................................
crossed:
if(GetSenderRef() == adj0) {
//If this isn't the starter cog of the set... load room 0
if(starter != 1) {
if(sec0 != 1) {
// Destroy all things in room 1 of the last cog.
call killflagged;
For(X=0; X<10; X=X+1) {
//Create the things for room 0.
tsec = FindSectorAtPos(pa[X]);
a0[X] = CreateThingAtPos(ta[X], tsec, pa[X], la[X]);
SetThingFlags(a0[X], flag);
}
sec0=1;
sec1=0;
if(devmode==1) {
print("Loaded.");
}
}
}
}
if(GetSenderRef() == adj1) {
//Load room 1 if it hasn't been done so already.
if(sec1 != 1) {
// Destroy all things in room 0.
call killflagged;
For(X=0; X<10; X=X+1) {
//Create the things for room 1.
tsec = FindSectorAtPos(pf[X]);
f0[X] = CreateThingAtPos(tf[X], tsec, pf[X], lf[X]);
SetThingFlags(f0[X], flag);
}
sec0=0;
sec1=1;
if(devmode==1) {
print("Loaded.");
}
}
}
if(GetSenderRef() == dadj0) {
//In case the player decides to go back to room 0...
if(sec0 != 1) {
// Destroy all things in room 1.
call killflagged;
For(X=0; X<10; X=X+1) {
//Re-create the things for room 0.
tsec = FindSectorAtPos(pa[X]);
a0[X] = CreateThingAtPos(ta[X], tsec, pa[X], la[X]);
SetThingFlags(a0[X], flag);
}
sec0=1;
sec1=0;
if(devmode==1) {
print("Loaded.");
}
}
}
if(GetSenderRef() == dadj1) {
//Load room 1 if it hasn't been done so already.
if(sec1 != 1) {
// Destroy all things created by the next cog.
call killflagged;
For(X=0; X<10; X=X+1) {
//Re-create the things for room 1.
tsec = FindSectorAtPos(pf[X]);
f0[X] = CreateThingAtPos(tf[X], tsec, pf[X], lf[X]);
SetThingFlags(f0[X], flag);
}
sec0=0;
sec1=1;
if(devmode==1) {
print("Loaded.");
}
}
}
return;
# .................................................. ......................................
end
Help plz?
I downloaded and ran ParSec on this, and it did pick up quite a few smaller errors, as well as picking up some MotS commands (this is for MotS) as errors.
There is, however, the main, and more serious error of the cog not running at all (well, at least not WORKING), and the fact that when adj1 is passed, the game crashes and returns to Windows.
Without further ado, my latest dysfunctional brainchild...
# Rites of Xanthus TC Cog Script
# Mysteries of the Sith
#
# Infinity.COG
# 5.30.02
# -by Lord_Grismath (GrismathDynasty@hotmail.com)
#
# Description:
#
#
# Instruction:
#
# Simply create your level without any regard to thing count (but keep
# hallways and doors to about 200). Then place this cog every two rooms,
# define all your Things and their Templates, and then delete the things.
# Run the level and voila, dynamically created Things based on the player's
# location.
#
# Set it up like so:
#
# Infinity Cog (starter) *end of 1st cog* Infinity Cog...
# sec0 adj1 dadj1 |
# [rm0] -- | -- | -- [rm1] -- | - * - | -- [rm0]...
# dadj0 sec1 (adj0 of next cog)
#
#
# ** POINTS OF INTEREST AND EDITATION **
# (i.e. the numbers with the stars in front of them)
#
# 1. TakeSector, :P, I'm thinking that I'll have to send Genesis to
# each individual pos vector, as there could (and probably will be)
# more than one sector in the room. :[ This is, btw, dynamically
# updated.
#
#
#
# 4. adj1 has been removed for redundancy issues. It is controlled
# by adj0 of the next cog. Thing genesis has been removed for the
# same reason.
#
#
# This Cog is Not supported by LucasArts Entertainment Co
symbols
message startup
message crossed
message user0
int starter=0 // Is this the first cog in the set? (1=Yes/0=No)
int ender=0 // Is this the last cog in the set? (1=Yes/0=No)
int sec0=0 local // Whether or not room 0 is loaded.
int sec1=0 local // The same for room 1
int flag=80 local // * NOTE: Check to see if this hex conversion is correct :P
surface adj0 // These adjoins load the rooms beyond *4
surface adj1
surface dadj0 // In case the player wants to go back
surface dadj1
sector tsec local // *1 - TakeSector, the sector in which the things are created
thing a0 local // *2 - The dynamically created Things. 50 per room.
thing a1 local // 'a'-'e' for room 0, and 'f'-'k' for room 1.
thing a2 local
thing a3 local
thing a4 local
thing a5 local
thing a6 local
thing a7 local
thing a8 local
thing a9 local
vector pa0 // World positional vectors for the dynamic things.
vector pa1
vector pa2
vector pa3
vector pa4
vector pa5
vector pa6
vector pa7
vector pa8
vector pa9
vector la0 // Look vectors for the things.
vector la1
vector la2
vector la3
vector la4
vector la5
vector la6
vector la7
vector la8
vector la9
template ta0 // Templates for the things.
template ta1
template ta2
template ta3
template ta4
template ta5
template ta6
template ta7
template ta8
template ta9
thing f0 local // *3 - Room 1's Things. (10 , 'f' only, for now)
thing f1 local // 'f'-'e' for room 0, and 'f'-'f' for room 1.
thing f2 local
thing f3 local
thing f4 local
thing f5 local
thing f6 local
thing f7 local
thing f8 local
thing f9 local
vector pf0 // World positional vectors for the dynamic things.
vector pf1
vector pf2
vector pf3
vector pf4
vector pf5
vector pf6
vector pf7
vector pf8
vector pf9
vector lf0 // Look vectors for the things.
vector lf1
vector lf2
vector lf3
vector lf4
vector lf5
vector lf6
vector lf7
vector lf8
vector lf9
template tf0 // Templates for the things.
template tf1
template tf2
template tf3
template tf4
template tf5
template tf6
template tf7
template tf8
template tf9
cog infmaster_cog
int devmode=0 local
int X=0 local
thing player local
end
# ================================================== ======================================
code
# .................................................. ......................................
killflagged:
For(X=0; X<=GetThingCount(); X=X+1) {
if(GetThingFlags(X) == flag) {
DestroyThing(X);
}
}
// Destroys things generated by this cog, i.e. with the defined flag.
return;
# .................................................. ......................................
startup:
player=GetLocalPlayerThing();
if(starter == 1) {
// Clean the slate of any flagged objects just in case.
call killflagged;
For(X=0; X<10; X=X+1) {
Create the things for room 0.
tsec = FindSectorAtPos(pa[X]);
a0[X] = CreateThingAtPos(ta[X], tsec, pa[X], la[X]);
SetThingFlags(a0[X], flag);
}
// Only set the variable AFTER the things have been created. :]
sec0 = 1;
if(devmode==1) {
print("Starting Room Initialised.");
}
}
return;
# .................................................. ......................................
user0:
//Sent from the infmaster.cog
devmode=1;
SendMessage(infmaster_cog, user0);
if(ender == 1) {
SendMessage(infmaster_cog, user1);
}
return;
# .................................................. ......................................
crossed:
if(GetSenderRef() == adj0) {
//If this isn't the starter cog of the set... load room 0
if(starter != 1) {
if(sec0 != 1) {
// Destroy all things in room 1 of the last cog.
call killflagged;
For(X=0; X<10; X=X+1) {
//Create the things for room 0.
tsec = FindSectorAtPos(pa[X]);
a0[X] = CreateThingAtPos(ta[X], tsec, pa[X], la[X]);
SetThingFlags(a0[X], flag);
}
sec0=1;
sec1=0;
if(devmode==1) {
print("Loaded.");
}
}
}
}
if(GetSenderRef() == adj1) {
//Load room 1 if it hasn't been done so already.
if(sec1 != 1) {
// Destroy all things in room 0.
call killflagged;
For(X=0; X<10; X=X+1) {
//Create the things for room 1.
tsec = FindSectorAtPos(pf[X]);
f0[X] = CreateThingAtPos(tf[X], tsec, pf[X], lf[X]);
SetThingFlags(f0[X], flag);
}
sec0=0;
sec1=1;
if(devmode==1) {
print("Loaded.");
}
}
}
if(GetSenderRef() == dadj0) {
//In case the player decides to go back to room 0...
if(sec0 != 1) {
// Destroy all things in room 1.
call killflagged;
For(X=0; X<10; X=X+1) {
//Re-create the things for room 0.
tsec = FindSectorAtPos(pa[X]);
a0[X] = CreateThingAtPos(ta[X], tsec, pa[X], la[X]);
SetThingFlags(a0[X], flag);
}
sec0=1;
sec1=0;
if(devmode==1) {
print("Loaded.");
}
}
}
if(GetSenderRef() == dadj1) {
//Load room 1 if it hasn't been done so already.
if(sec1 != 1) {
// Destroy all things created by the next cog.
call killflagged;
For(X=0; X<10; X=X+1) {
//Re-create the things for room 1.
tsec = FindSectorAtPos(pf[X]);
f0[X] = CreateThingAtPos(tf[X], tsec, pf[X], lf[X]);
SetThingFlags(f0[X], flag);
}
sec0=0;
sec1=1;
if(devmode==1) {
print("Loaded.");
}
}
}
return;
# .................................................. ......................................
end
Help plz?