seeing values during game play
-
carbon dude oxide
- Trained

- Posts: 141
- Joined: 28 Apr 2011, 07:46
seeing values during game play
hello is there a way of printing / showing the values within the rules.js? ive been having trouble with a script that i am making but i do not see what is wrong with the i function
the main reason that i think is the poblem is that the distance is higher than 5 so i would like to be able to print the value each time the funtion is called (its on a 5 second repeating timer)
if (distBetweenTwoPoints(FirstTrans.x, FirstTrans.y, FirstLZX, FirstLZY)<=5)
{
setMissionTime(600);
removeTimer("checkPosition");
}
the main reason that i think is the poblem is that the distance is higher than 5 so i would like to be able to print the value each time the funtion is called (its on a 5 second repeating timer)
if (distBetweenTwoPoints(FirstTrans.x, FirstTrans.y, FirstLZX, FirstLZY)<=5)
{
setMissionTime(600);
removeTimer("checkPosition");
}
-
carbon dude oxide
- Trained

- Posts: 141
- Joined: 28 Apr 2011, 07:46
Re: seeing values during game play
ok i have found out how to do it but there is a problem :/ the FirstTrans (super transport specified in anoher function) is not updating :/ no mater were the droid moves it is always displaying a distance of 6 (thats the distance initialy when the FirstTrans value is set to droid object ) :/ why is it not changing :/
-
NoQ
- Special

- Posts: 6226
- Joined: 24 Dec 2009, 11:35
- Location: /var/zone
Re: seeing values during game play
Are you storing a droid object? You shouldn't store a droid object. It is just a read-only copy. It is not supposed to be updated. We already discussed that.
If not, i repeat it again: please post the complete code, we're no shamans to answer questions like "why my code that i won't ever show to you isn't working?" :/
If not, i repeat it again: please post the complete code, we're no shamans to answer questions like "why my code that i won't ever show to you isn't working?" :/
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
-
carbon dude oxide
- Trained

- Posts: 141
- Joined: 28 Apr 2011, 07:46
Re: seeing values during game play
Ok so how would i make it so i can access that droid in other functions? Would i store its ID and search for it each time?
-
NoQ
- Special

- Posts: 6226
- Joined: 24 Dec 2009, 11:35
- Location: /var/zone
Re: seeing values during game play
You just seek for it again and again every time you need it, the same way you found it the first time.
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
-
carbon dude oxide
- Trained

- Posts: 141
- Joined: 28 Apr 2011, 07:46
Re: seeing values during game play
ok ive gotten around that problem but i have narrowed it down to one line:
this isthe line that iscausing all of the problems :
orderDroidObj(droids, DORDER_EMBARK, droida);
but i do no know why ^.^ please help me
Code: Select all
function startFlight();
{
removeTimer("startFlight");
removeTimer("preBoard");
var droida;
var droidsa=enumDroid();
for (i=0; i<droidsa.length; i++)
{
if (droidsa[i].id==FirstTransID)
{
droida=droidsa[i];
break
}
}
if (droida)
{
var droids=enumDroid();
for (i=0; i<droids.length; i++)
{
if (droids[i].group==9)
{
if (distBetweenTwoPoints(droids[i].x, droids[i].y, FirstLZX, FirstLZY)>=5)
{
orderDroidObj(droids[i], DORDER_EMBARK, droida);
}
}
}
}
}orderDroidObj(droids, DORDER_EMBARK, droida);
but i do no know why ^.^ please help me
You do not have the required permissions to view the files attached to this post.
-
NoQ
- Special

- Posts: 6226
- Joined: 24 Dec 2009, 11:35
- Location: /var/zone
Re: seeing values during game play
The first problem i'm seeing here is
Then to the topic: are you encountering this error?Pretty funny, pre-placed transporters don't have a group for storing their contents?
i think it's a bug, need to report.
Or can you post the whole map so that i could run it?
Also/hint: if you're looking for your transporter in multiple places, you can make a function to look for it:
Also/hint: you seem to be using timer for startFlight() but want it to be called only once, so what you want is a queue() call instead, should be one line shorter:
function startFlight();
Another thing that can't work (what did you mean here?) is;
if (droids.group==9)
Then to the topic: are you encountering this error?
Code: Select all
info |09:41:33: [checkTransporterSpace:1428] tranporter doesn't have a group
info |09:41:33: [checkTransporterSpace:1428] Assert in Warzone: transporter.cpp:1428 (psTransporter->psGroup != __null), last script event: 'N/A'Or can you post the whole map so that i could run it?
Also/hint: if you're looking for your transporter in multiple places, you can make a function to look for it:
Code: Select all
function getFirstTrans()
{
// in skirmish human player is always player 0, regardless of position
// if you're using a cyborg transport, use DROID_TRANSPORTER instead
var droids=enumDroid(0, DROID_SUPERTRANSPORTER);
for (i=0; i<droids.length; i++)
{
if (droids[i].id==FirstTransID)
{
return droids[i];
}
}
}
Code: Select all
queue("startFlight",1000); // 1 secondMaps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
-
NoQ
- Special

- Posts: 6226
- Joined: 24 Dec 2009, 11:35
- Location: /var/zone
Re: seeing values during game play
Emm sorry nvm, you're not using a pre-made transporter ... need to look again.
P.S. the fancy transporter bug we've found here (not related to your problem) is now discussed in #3714.
P.S. the fancy transporter bug we've found here (not related to your problem) is now discussed in #3714.
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
-
carbon dude oxide
- Trained

- Posts: 141
- Joined: 28 Apr 2011, 07:46
Re: seeing values during game play
Right basicaly what is happening once you have researched super transporter you are able to research landing pads, you can build supertransports ect, once two LZ's have been made the next super transporter that is made gets assigned to FirstTrans it then automaticaly labds on the first LZ. For the next 60 seconds it gets all units in group 9 to move to Where the super transport is and this is where the problem is is getting the droids to embark the super transport...
Ive commented this line out and the whole script works fine (also its not a specific map at the moment ive just replaced rules.js so it works on all maps.
This is mainltly a thing im doing to mess around and make stuff so yea
I disnt have time to explain what the script dis when i first posted but tada
Ive commented this line out and the whole script works fine (also its not a specific map at the moment ive just replaced rules.js so it works on all maps.
This is mainltly a thing im doing to mess around and make stuff so yea
I disnt have time to explain what the script dis when i first posted but tada
-
carbon dude oxide
- Trained

- Posts: 141
- Joined: 28 Apr 2011, 07:46
Re: seeing values during game play
Also how did you get a debug concol that shows the errors in game? I cant find it :/
-
NoQ
- Special

- Posts: 6226
- Joined: 24 Dec 2009, 11:35
- Location: /var/zone
Re: seeing values during game play
What sort of group is that? What a group is, anyway? There are many notions of a group in the game. Most importantly, groups that JS deals with have nothing to do with groups you assign units to by ctrl+9 etc. You must create the groups you use in your JS via newGroup().group 9
P.S. btw you can make a group to store your transporter, so that you didn't have to look for it all the time.
http://developer.wz2100.net/wiki/FileLocationscarbon dude oxide wrote:Also how did you get a debug concol that shows the errors in game? I cant find it :/
The "logs" thing.
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
-
carbon dude oxide
- Trained

- Posts: 141
- Joined: 28 Apr 2011, 07:46
Re: seeing values during game play
Ok so how would i see what group (ctrl+number) a droid is in?
-
NoQ
- Special

- Posts: 6226
- Joined: 24 Dec 2009, 11:35
- Location: /var/zone
Re: seeing values during game play
I don't think you can do that. Do you really want it? Why force a player press ctrl+9 for your script to work, unless you want to teach the player how to press ctrl+9?
(the thread for js function/feature requests is here)
(the thread for js function/feature requests is here)
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
-
carbon dude oxide
- Trained

- Posts: 141
- Joined: 28 Apr 2011, 07:46
Re: seeing values during game play
Im just messing around to see what i can do with the game ^.^
The main use of seeing if the droid in in ctrl 9 is so the script knows what drouds the player wants transporting
The main use of seeing if the droid in in ctrl 9 is so the script knows what drouds the player wants transporting