Author Topic: How to start out?  (Read 2903 times)

Moar additional photos

I tested it again, The description thing clearly didn't matter towards the script.

Are you hosting a server and ticking off the add-on in the list before hosting?

Are you hosting a server and ticking off the add-on in the list before hosting?
It doesnt show up as an add-on, and im testing in single player.

It doesnt show up as an add-on, and im testing in single player.
It should. Try exec("Add-Ons/Script_Test/server.cs"); in console.

The thing is guys, you're putting this into a server sided script for something which only can affect the client who's hosting the server. (That's if it isn't dedicated. If it was dedicated, it'd be completely useless.)

If you made it a client.cs file, when you type in test(); that'd work for you in whatever server, whenever. At least that code is executed.



You can also send CommandToClient() stuff if you just want to send it to any client in the server. I am sure someone can explain in more detail.
« Last Edit: September 02, 2012, 06:49:53 AM by nerraD »

It should. Try exec("Add-Ons/Script_Test/server.cs"); in console.
Works. Do I always need to do that before trying a script or something?

"exec" re-executes your script manually.

When Blockland starts up, it converts all file.cs files into machinecode (i think .dso?) and loads them into its cache. If you change your file.cs while Blockland is running, and then call your function from the console again, it will execute the cached version (the old one).

Exec reloads your file.cs into Blocklands cache.


If you're a beginner, your Blockland will crash regularly from reexecing scripts due to wrong syntax. If that happens, and you want to check what the f*ck happened, open the console.log in your Blockland folder and scroll down till the end of the file. The console.log (open it with notepad for example) is a log of what Blockland did while it was running, stuff like echo("test test"); will appear in this log.



The %obj.dump(); function might be of some use to you, too. It writes all related functions to that object into the console, and therefore into console.txt.
%obj is a variable, the . indicates that dump is called on %obj.
%obj could be a client number for example or a number of an object (vehicle/player maybe)
Try looking at a vehicle, enter /getid into the chat, memorize the number as %number and enter %number.dump(); into your console. Magic happens.

Vehicle example:
Code: [Select]
%number.addVelocity("0 0 10");
("0 0 10") is a 3d vector, with x=0, y=0, and z=10. Therefore to your vehicles velocity will be added 10 units of speedstuff in the positive z direction, which would be upwards.

For the other basic script stuff just visit the Coding Help section of this forum and look through all sticky threads, also General Modification Help theres a Topic labeled 'Big list of tutorials'
« Last Edit: September 02, 2012, 09:34:13 AM by Schorle »

When Blockland starts up, it converts all file.cs files into machinecode (i think .dso?)
.dso is not machinecode, that would be assembly code, which the .dso's are converted into by blockland's private decompiler.

"exec" re-executes your script manually.

and loads them into its cache. No, it converts it into assembly code.

Exec reloads your file.cs into Blocklands cache. What???

If you're a beginner, your Blockland will crash regularly from reexecing scripts due to wrong syntax. no. just no. Bad syntax will NOT crash your game.

%obj could be a client number for example or a number of an object (vehicle/player maybe) It can be any object.

Vehicle example:
Code: [Select]
%number.addVelocity("0 0 10");
("0 0 10") is a 3d vector, with x=0, y=0, and z=10. No, it's a string that is parsed by the function AS a 3d vector. There is no 3d vector type in blockland.

Therefore to your vehicles velocity will be added 10 units of speedstuff in the positive z direction, which would be upwards. "speedstuff" ???
plEEEAse, don't post in here if you don't know what you're talking about.

Well, yes some stuff was not correct, i am sorry.

Well, yes some stuff was not correct, i am sorry.
You guys are equally wrong.

Exec reloads your file.cs into Blocklands cache.
Slightly right, functions just executed from a file are loaded into memory as TorqueScript. Ipquarx, no assembly involved.

If you're a beginner, your Blockland will crash regularly from reexecing scripts due to wrong syntax. If that happens, and you want to check what the f*ck happened, open the console.log in your Blockland folder and scroll down till the end of the file.
Not really true, but if you add a parameter to exec() as a "1", it's called a journal; it will not run the functions but simply reload them. It's prone to crashing for whatever reason.

Kalphiter is the most right. TorqueScript is parsed in real time by the TS engine in TGE. That's essentially why all your code is so slow. Executing also won't crash your game unless you have some kind of infinite loop that is called instantly upon execution or something that would cause a buffer overrun. You can be creative with the ways to crash your game but really it shouldn't happen and if it does you most likely accidentally have an infinite loop in your code.

Ok, I got that done, what do you guys recommend me doing next?

Edit: Also can you teach me what all those symbols and those different categories or whatever mean? I don't know the terms, so I'm just gonna call them that. lol
« Last Edit: September 02, 2012, 02:16:14 PM by Kimon »

Executing also won't crash your game unless you have some kind of infinite loop that is called instantly upon execution or something that would cause a buffer overrun,
Actually it normally won't cause a crash, just an unresponsive game.

Actually it normally won't cause a crash, just an unresponsive game.
Which is what crashing means.