Game Development Community

Tdn scripting problem

by Taslim Dosunmu · in Technical Issues · 06/29/2007 (9:32 am) · 19 replies

I,ve done everything in the tutorial and typed the scripts, but when i run into the torque thing it doesn't
boost my score can someone explain this?

#1
06/29/2007 (9:38 am)
This is what my code looks like
exec("./client/Game.cs");
that's my main.cs update

my other code for client game.cs looks like
function clientCmdSetScoreCounter(%score)
{
   ScoreCounter.setText("Score:" SPC %score);
}

function clientCmdShowVictory(%score)
{
   MessageBoxYesNo("You Win!",
        "Would you like to restart the game ?",
        "loadMyMission();",
        "quit();");
}

my last one is

function torquelogoitem::onCollision(%this, %obj, %col)
{
   if(%col.getClassName() $= "Player")
   {
      %client = %col.client;
      %client.score++;
      commandToClient(%client, 'setScoreCounter', %client.score);
      
      %obj.delete();
      %logoCount = logos.getCount();
      if(%logocount > 0)
        return;
      commandToClient(%client, 'ShowVictory', %client.score
   }
}

and that is my torquelogo.cs
#2
06/29/2007 (9:51 am)
exec("./client/clientGame.cs");

that looks like a typo--shouldn't it be exec("./client/Game.cs"); ?

There are also several obvious typos in your torquelogoitem::onCollision function especially the last commandToClient line:

%clent.score -- should be %client

the line isn't in valid TorqueScript syntax--you are missing ); at the end at a minimum.

If you haven't started working with Torsion yet, it can be an amazing tool to help you catch a lot of flow and TorqueScript syntax errors.

EDIT: Very good job by the way on presenting to us your changes--it's much easier to help when you show us what you've done, instead of saying "it doesn't work"--and I'm glad to see you giving more information :)
#3
06/29/2007 (11:20 am)
Thank you very much.
ummm i fixed it the way you said to, but now the score wont go up. Any ideas?
#4
06/29/2007 (11:43 am)
--Are you execing the file that has the "torquelogoitem::OnCollsion" code on the server side (in the /server/scripts directory)

--do you have a datablock properly defined and exec'd called "torquelogoitem"?

--when you create your "pickup items", are you assigning them the torquelogoitem datablock?

Finally, when you open up the console do you see any script errors (check the console status line up top), or if using Torsion, does it report any compilation errors?
#5
06/29/2007 (1:19 pm)
Ok.... I have no idea what you're describing,but ok.
#6
06/29/2007 (2:44 pm)
If you dont know what he is talking about that prolly means ur grasping a subject out of your league. Slow down and take the basic stuff first. I recomend coding some HTML pages with PHP and mySql, so u get the feeling for code n stuff.
#7
06/29/2007 (5:02 pm)
Ive done that but i just need explanation to go through the steps.
#8
06/29/2007 (5:14 pm)
So basicaly you want someone to write your whole game for you, step-by-step? You dont learn from other peoples doing for you. I recognize your code snippets, and i see that they are from a tutorial. Tutorials usaly include, text, try reading that. And i doubt you dealt with HTML and php and other web related stuff, because if you did, you would have learnt to be patient yet persistent, a very fine attribute, and you would have easier seeing what properties aftect what in the game world. I get the idead that your twelve, have played world of warcraft, and now want do your own game. Which is totaly awesome, its always fun with creative people, but as i said before, and some dudes before me: be patient. Another tip, is to fuck world of warcraft, and go Diablo instead. World Of Warcraft is such and disapointment, i dont even consider it canon to the warcraft universe, since the art and style is not even close to it(any of you guys remmber the concept sketches for the Night Elves? Were they looked feral and grim and totaly awesome, and not like busty pornstars wielding pansy longbows?). Diablo beats World Of Whorecraft anyday
#9
06/29/2007 (5:52 pm)
Ive done that but i just need explanation to go through the steps.
#10
06/29/2007 (7:54 pm)
@Ted - At what point did you feel it was constructive to derail this thread and rip into someone? Did you have a bad day? In what way is belittling someone constructive? Further more, while your Diablo vs WoW rings true in my opinion, the comparison being used in a thread created to further learn game development is asinine. For someone who preaches the value of patience, perhaps you should hone your own skills before butting in on a constructive thread that could not only serve the original poster, but future readers and newcomers.

@Taslim - I highly recommend you take the time to really read into the comments of those helping you out. Spend a few extra hours to try out the code and search through existing scripts (like those found in starter.fps and starter.racing) to find similar code to what you are trying to achieve.

Now, specifically for what Stephen is saying:

He was recommending that you check the script file that contains the function torquelogoitem::OnCollsion . If you have this script file, make sure that you are calling exec(""). Otherwise, no collision will occur between the player and the logo, which means no score increase will occur.

Also, he was recommending that you coded a datablock for the Torque logo properly. Check the console.log, which is found in the same folder as the torqueDemo.exe. Search for words such as "parse error" and "could not." These usually show you lines that have syntax errors and improper coding.

The last part he touches on is making sure the objects you put in the world (Using the WorldEditor - F11), have a field specifying : dataBlock = torquelogoitem.

You can do this in script, or you can do this in the WorldEditor.

Let us know if that clears up any confusion.
#11
06/29/2007 (8:39 pm)
Sorry if I misinterpreted Stephens post, did you manage to get the article corrected?
#12
07/03/2007 (7:44 am)
Uuuuuumm dude i just need someone to explain what im doing wrong.
I've definitely done web design and i'm 13. Plus i hate world of warcraft!
#13
07/03/2007 (7:47 am)
Hey thanx for the help man i'll post if i need helop.
#14
07/03/2007 (7:56 am)
Oh my god this is not right! I did what you said but now i cant even walk through it let alone have it disappear. help? I mod'd it by executing the server file logoitem.cs but it isnt working.
#15
07/03/2007 (8:15 am)
Remain calm =)

Check the public forum for the tutorial, I bet you'll find your answer in there. Click here and browse through the threads talking about the tutorial. I 100% guarantee you that you'll find your answer, as I've seen the same problem in a thread before.


EDIT- This is also a great forum to visit in your case: Getting Started

Lots of tutorial based and script learning threads there.
#16
04/20/2011 (6:39 pm)
Sorry buddy something I've learned here is nobody helps you they just throw technical jargon at you saying that's easy and the problem is never solved... So far nobody here has fixed any of my issues either so your not the only one...
#17
04/20/2011 (6:52 pm)
Quote:
From and including: Tuesday, 3 July 2007
To and including: Wednesday, 20 April 2011

It is 1388 days from the start date to the end date, end date included

Or 3 years, 9 months, 18 days including the end date
Alternative time units
1388 days can be converted to one of these units:

* 119,923,200 seconds
* 1,998,720 minutes
* 33,312 hours
* 198 weeks (rounded down)
#18
04/20/2011 (7:20 pm)
To-mos... just shut up
#19
04/20/2011 (11:08 pm)
hahaha steve your dead post replys made me laugh pretty hard two different times tonight.