| Blockland Forums > Modification Help |
| Key Functions |
| (1/4) > >> |
| ThinkInvisible:
I had several ideas for scripts but i'm missing a few keyboard functions. -How do i detect if a key is being held down/is released/was just pressed? -How do i detect what keys are currently being held down? If i know the above i could just set up a loop or something. -How do i simulate a keypress? And a few other things i should ask about: -Exactly what does the operator "^" do? -I'm also trying to make a mod that creates crosshairs over other players. Just for coolness. How would I convert a 3D position into a 2D position, and test if it would be offscreen? -Why does player.setPosition("x y z"); crash the server, as opposed to player.position = "x y z"? -What happens when you reach 100k X/Y on the map? 1mil? -I found out spawning many projectiles at once makes you ghost. Whyzat? I thought that's only for bricks. -Does using > instead of >= do anything besides change the operator type? -What does if(!%var) do? I used it for a ServerCmd to show if it had the right number of arguments and it didn't work. -How do i get the range and angle from/to two objects? I use a big complicated structure involving getPosition(), ifs, and a lot of subtraction. -What's the best way to spawn a bot that Blockland treats like a player? Testing purposes. --If possible, include a way to give it a client and make a new clientobject. -Is there a way to tumble a player without actually tumbling the player? (Set aim) -Is there a way to switch the controlobject of two players/vehicles/etc? I've tried and it crashes everyone. |
| Daenth:
--- Quote from: ThinkInvisible on August 06, 2011, 01:54:30 PM ---I had several ideas for scripts but i'm missing a few keyboard functions. -How do i detect if a key is being held down/is released/was just pressed? -How do i detect what keys are currently being held down? If i know the above i could just set up a loop or something. -How do i simulate a keypress? And a few other things i should ask about: -Exactly what does the operator "^" do? -I'm also trying to make a mod that creates crosshairs over other players. Just for coolness. How would I convert a 3D position into a 2D position, and test if it would be offscreen? -Why does player.setPosition("x y z"); crash the server, as opposed to player.position = "x y z"? -What happens when you reach 100k X/Y on the map? 1mil? -I found out spawning many projectiles at once makes you ghost. Whyzat? I thought that's only for bricks. -Does using > instead of >= do anything besides change the operator type? -What does if(!%var) do? I used it for a ServerCmd to show if it had the right number of arguments and it didn't work. -How do i get the range and angle from/to two objects? I use a big complicated structure involving getPosition(), ifs, and a lot of subtraction. --- End quote --- #1: http://forum.blockland.us/index.php?topic=162665.msg3986250#msg3986250 #2: This is a "Bitwise XOR", this is straight from the TAG: "Example: $a ^ $b, Explanation: composite of elements where bits in the same position are opposite. (i.e. 100b & 101b == 001b)" #3: You'd still be working with 3D coordinates, therefore you wouldn't need to convert them into 2D coordinates (which is impossible because 3D has three axises and 2D has two axises). #4: You are probably using the first function incorrectly, while the second one is editing the players position, not setting it. #5: Nothing, the terrain just repeats. If you are on Slate then the ground will be "no-collide" and you'll fall in water but that is it. #6: I assume your game needs to "render" those projectiles putting you into a ghosting state. #7: Nope. #8: If %var is equal to 0 then run what ever is in the if statement. If you didn't have the '!' in front of it, then it would be if %var is equal to 1 then run whatever is in the if statement. #9: If your function works, use it. |
| ThinkInvisible:
--- Quote from: Daenth on August 06, 2011, 02:20:53 PM ---#1: http://forum.blockland.us/index.php?topic=162665.msg3986250#msg3986250 #2: This is a "Bitwise XOR", this is straight from the TAG: "Example: $a ^ $b, Explanation: composite of elements where bits in the same position are opposite. (i.e. 100b & 101b == 001b)" #3: You'd still be working with 3D coordinates, therefore you wouldn't need to convert them into 2D coordinates (which is impossible because 3D has three axises and 2D has two axises). #4: You are probably using the first function incorrectly, while the second one is editing the players position, not setting it. #5: Nothing, the terrain just repeats. If you are on Slate then the ground will be "no-collide" and you'll fall in water but that is it. #6: I assume your game needs to "render" those projectiles putting you into a ghosting state. #7: Nope. #8: If %var is equal to 0 then run what ever is in the if statement. If you didn't have the '!' in front of it, then it would be if %var is equal to 1 then run whatever is in the if statement. #9: If your function works, use it. --- End quote --- #3: But how do I display a crosshair on a 2D GUI which seems like it's above the player in the 3D game? #8: What i meant is: function servercmdlolblargh(%c, %a, %b) { if(!%b) { //asdf //%b was not defined, so they must have thought a was b. return; } dostuff(%a, %b); } %b always registers as %a in this case, making //asdf always trigger. #9: It's huge. And messy. And i really think there's a better method. EDIT: #1: Idungetit. |
| Daenth:
--- Quote from: ThinkInvisible on August 06, 2011, 02:26:14 PM --- #3: But how do I display a crosshair on a 2D GUI which seems like it's above the player in the 3D game? #8: What i meant is: function servercmdlolblargh(%c, %a, %b) { if(!%b) { //asdf //%b was not defined, so they must have thought a was b. return; } dostuff(%a, %b); } %b always registers as %a in this case, making //asdf always trigger. #9: It's huge. And messy. And i really think there's a better method. --- End quote --- #3: If you're trying to do it client-sided, you'll need to spawn client-sided bots are the players and spawn or display images above them. It's very inefficient and does not work properly without a powerful machine. #8: if(%b $= ""), if the variable was not defined then it should come out as null, in which case you would check to see if it's string equals null. #9: I'll see if I can get a clean one working or find a clean one. EDIT: To explain #1: $remapDivision[$remapCount] = "KEYBINDCATEGORYNAME"; This will put your keybind under CATEGORYNAME in the menu. $remapName[$remapCount] = "KEYBINDNAME"; This is the actual name of the keybind in the menu. $remapCmd[$remapCount] = "FUNCTIONNAMEHERE"; This will be the function that is called when the key is pressed. |
| ThinkInvisible:
Oh, and #1: I need it to be for any key, not just a keybinded key |
| Navigation |
| Message Index |
| Next page |