| Blockland Forums > Modification Help |
| Iban Explains it All |
| << < (23/39) > >> |
| Red_Guy:
Be sure to test your script with /getid to make sure your getting the right answer. so something like this: /objtest <some position> /getid < some id> goto console: echo(<some id>.getposition() ); do they match? it also might be helpful to print the id and classname of the brick you found. Then you know you got a real brick, and not something wierd. |
| Treynolds416:
--- Quote from: Red_Guy on March 22, 2011, 05:41:52 PM ---Be sure to test your script with /getid to make sure your getting the right answer. so something like this: /objtest <some position> /getid < some id> goto console: echo(<some id>.getposition() ); do they match? it also might be helpful to print the id and classname of the brick you found. Then you know you got a real brick, and not something wierd. --- End quote --- Yes I've been doing that. It works perfectly for baseplates and the object is not found for any of the other bricks that I have tested. It matches up every time for the baseplates as well. |
| Iban:
first and foremost why the hell are you using the actual function clientCmdCenterPrint? commandToClient(%client, 'centerPrint', "foobar.", 3); OR %client.centerPrint("foobar.", 3); clientCmdCenterPrint only works with the actual client the mod is installed on. If you try this on a dedicated server even the message will not work. I'm getting tired of trying to find the problem in your code so here's what should work. --- Code: ---// Learn to camel-case. function serverCmdObjTest(%client) { // Get the player. %obj = %client.player; // If they don't have a player we can't do anything. if(!isObject(%obj)) { %client.centerPrint("\c5Spawn first, dummy.", 2); return; } // Space Guy's code (iban no good at math) // Used to figure out in which direction the player is looking. %fvec = %obj.getForwardVector(); %fX = getWord(%fvec, 0); %fY = getWord(%fvec, 1); %evec = %obj.getEyeVector(); %eX = getWord(%evec, 0); %eY = getWord(%evec, 1); %eZ = getWord(%evec, 2); %eXY = mSqrt((%eX * %eX) + (%eY * %eY)); %aimVec = (%fX * %eXY) SPC (%fY * %eXY) SPC %eZ; // Our range is the maximum that is stable for raycasts. %range = 100; // Multiple the aimvec and add it to our starting position to get an end point. %end = vectorAdd(%start, vectorScale(%aimVec, %range)); // Masks // AlwaysObjectType will hit non-raycasting bricks, too. %masks = $TypeMasks::FxBrickAlwaysObjectType; // Get the collision object of the raycast. %col = firstWord(containerRayCast(%start, %end, %masks, %obj)); if(!isObject(%col)) { %client.centerPrint("\c5Look at a brick, dummy.", 2); return; } messageClient(%client, '', "\c5BRICK POSITION\c6:" SPC %col.getPosition()); echo("BRICK POSITION:" SPC %col.getPosition()); } --- End code --- If you have any other problems, make a new thread. This is "Iban Explains it All" not "Treynolds416 gets people to resolve his scripts for him." |
| Jasa 12265:
Iban, please make a tutorial on databases and information storing. |
| Narkro555:
Alright, I understand what the emitter datablock commands do, but for color, which of the four value represents what? Red Green Blue Alpha? A R G B? |
| Navigation |
| Message Index |
| Next page |
| Previous page |