| Blockland Forums > Modification Help |
| Keybinds |
| << < (3/4) > >> |
| Nexus:
you declare a function, then declare a package, then declare a function all inside of each other. You don't seem to know how to use curley brackets, I just see them flung all over the place. The name of the variable %whatever does not matter as long as you use the same name whenever you want to use that variable in the function. Redefining the same function in two different packages is a waste. You really should be reading through some more scripts made by other people before attempting your own. At least get an idea for how the syntax is supposed to go. I think what you want is for someone to just go ahead and fix this for you, but that isn't a good part of the learning experience. |
| jes00:
--- Quote from: Nexus on July 21, 2011, 11:59:36 PM ---I think what you want is for someone to just go ahead and fix this for you, but that isn't a good part of the learning experience. --- End quote --- Please :panda: |
| Placid:
--- Quote from: jes00 on July 21, 2011, 07:08:08 PM ---I tried the following and the keybinds did not show up in the options menu. --- End quote --- I don't suggest you use this mod, but oh well, your choice. --- Code: ---if(!$Greet::Binds) { $remapDivision[$remapCount] = "Hi and Bye Mod"; $remapName[$remapCount] = "Toggle"; $remapCmd[$remapCount] = "client_hiandbye"; $remapCount++; $Greet::Binds = 1; } //you had a function before the packages; //i don't even think that works //also your brackets were a bit confusing in //the functions/packages area, you want to make it easy on the eye package greet { //this i know you just copied from something function newChatHud_addLine(%text) { Parent::newChatHud_addLine(%text); %nameToGreet = strReplace(%text," connected.",""); if(%nameToGreet !$= %text) { commandtoserver('messagesent',"Hello " @ %nameToGreet @ "."); } } }; package bye { //with minor changes, same as above function newChatHud_addLine(%text) { Parent::newChatHud_addLine(%text); %nameToBye = strReplace(%text," has left the game",""); if(%nameToBye !$= %text) { commandToServer('messagesent',"Bye, " @ %nameToBye @ "."); } } }; function client_hiandbye() { //your on and off functions were never being called. this is called by keybind. if($Greet::On) { deactivatepackage(greet); deactivatepackage(greet); $Greet::On = 0; return; } if(!$Greet::On) { activatePackage(greet); activatePackage(bye); $Greet::On = 1; return; } } --- End code --- added comments with (some of) what you did wrong. but yeah i'd mostly work on your spacing for right now, when you can look at it easier it makes it easier to edit and easier for others to see what's wrong, as well as help you (that is, without rewriting your whole script) this isn't guaranteed to work, i'm not about to go test an autogreet mod and make myself look like a handicapped little forget --- Quote from: Nexus on July 21, 2011, 11:59:36 PM ---I think what you want is for someone to just go ahead and fix this for you, but that isn't a good part of the learning experience. --- End quote --- eh, i just gave a shot at it ninja, also please know that i'm not always going to be here to make your scripts for you. get independent. |
| Nexus:
Placid. You should combine the two packages, there is no reason to not have just one. If you test for a variable to be true, change it to false, then test for it being false, that will not work. Edit in bold Oh and I forgot to mention the %x test for if it is being pressed or released. |
| Placid:
--- Quote from: Nexus on July 22, 2011, 08:44:10 AM ---You should combine the two packages, there is no reason to have just one. If you test for a variable to be true, change it to false, then test for it being false, that will not work. --- End quote --- 1. eh, true, i was basing it off his.. if it was my project i would. 2. ah forget forgot the return, thank you |
| Navigation |
| Message Index |
| Next page |
| Previous page |