| Blockland Forums > Modification Help |
| Iban Explains it All |
| << < (21/39) > >> |
| Bauklotz:
vertSizing and horizSizing properties in the GUI. |
| Treynolds416:
I have another question. How would I go about getting the position of a brick I am looking at? As in, type /getbrickposition and you will get the xyz coordinates of the brick that is in your direct line of sight. Things I know: I can't find a default function for this The only thing close to it is /GetId, which is kind of what I want this to behave like I know the final line has to be something like echo(id.getposition()); Things I don't know: If I do use a combination of ServerCmdGetId and getWord, which string should I search in? And basically everything else I believe myself to be fairly intelligent, scripting just does not come naturally to me. Any help would be appreciated greatly. |
| Red_Guy:
--- Quote from: Treynolds416 on March 21, 2011, 04:32:48 PM ---I have another question. How would I go about getting the position of a brick I am looking at? As in, type /getbrickposition and you will get the xyz coordinates of the brick that is in your direct line of sight. Things I know: I can't find a default function for this The only thing close to it is /GetId, which is kind of what I want this to behave like I know the final line has to be something like echo(id.getposition()); Things I don't know: If I do use a combination of ServerCmdGetId and getWord, which string should I search in? And basically everything else --- End quote --- Your going to need to make a copy of the insides of serverCmdGetID -- I dont know where you will find that. but the concept is this: player types: /getbrickposition you write function serverCmdGetbrickposition(%client) and inside you do this: - do a "raycast" to findout the brick the player is looking at that will eventually give you a brick. - use: echo(%brick.getposition() ); or MessageClient( ) to display the position. the raycast thing is used in several places... I use a copy in my own stuff, but I cant remember which mod I copied it from. |
| lilboarder32:
Here is the basis for that Treynolds: %obj would be the player of the client who calls the command. --- Code: ---%scale = vectorScale(%obj.getEyeVector(),100); %ray = containerRaycast(%obj.getEyePoint(),%scale,$Typemasks::fxBrickObjectType); if(isObject(firstWord(%ray))) { %brick = firstWord(%ray); Announce(%brick.getPosition()); } --- End code --- This is untested and written from my phone, but feel free to take it and try it out/mess with it |
| Deathwishez:
Is there a list of default functions somewhere? Or will I have to scavenge for them by tracing? |
| Navigation |
| Message Index |
| Next page |
| Previous page |