| Blockland Forums > Modification Help |
| Easy way to know what variables are used in Parents? |
| (1/2) > >> |
| Daenth:
Is there any way to easily find out what variables are used in a parent? Such as ::onFire(variables)? |
| Xalos:
Unfortunately, no, unless someone already knows or it gives an error when you use it wrongly. For example, the code "getSubStr();" gives you an error telling you the three variables it uses. However, you CAN package the unknown function and then cause it to be called. package getInfo { function Armor::onTrigger(%a, %b, %c, %d, %e, %f, %g, %h, %i, %j) { %ret = Parent::onTrigger(%a, %b, %c, %d, %e, %f, %g, %h, %i, %j); echo("Armor::onTrigger(\""@%a@"\", \""@%b@"\", \""@%c@"\", \""@%d@"\", \""@%e@"\", \""@%f@"\", \""@%g@"\", \""@%h@"\", \""@%i@"\", \""@%j@") returns \""@%ret@"\""); if(%ret !$= "") return %ret; } }; activatePackage(getInfo); |
| Chrono:
Or you can type trace(1);, call the function naturally (not through console or script, such as jumping to call onTrigger) It'll show you a list of what it did, in this case it would show Armor::onTrigger(some number less than 4100, some number over 4100, 2, 1) This will always return the second arg then Armor::onTrigger(some number less than 4100, some number over 4100, 2, 0) This will always return 0 From this we can see that: The first one is a datablock. The second one is an object. The third one is probably the slot of the trigger. The forth one is press or release. To find out what kinds of objects these are, for example, if the first number was 44 and the second one was 157083. echo(44.getClassName()); This tells you PlayerData. This means that it's a player datablock. Because this is a player datablock function, the next argument will most likely be the player object, but let's check to make sure. echo(157083.getClassName()); It tells you Player. This means that it is indeed a player object. This means: Armor::onTrigger(datablock, object, slot, value) So then we try to figure out which slot is which. So we trace again, and press in this order: shoot, jet, and crouch. We already know jump is 2. Shoot gave us 0, jet gave us 4, and crouch gave us 3. This means that: 0 = Shoot 2 = Jump 3 = Crouch 4 = Jet There is a trigger for 1, called AltTrigger, but this is unused in Blockland, and is not in your controls by default. The function still exists, but is only able to be used for weapons like akimbo guns, which allows you to shoot just the left gun. Also as a side note, any object ID less than 4100 is a datablock, except for rootGroup (-1), false (0), true (1), and whatever the hell is using the ID 2. |
| Daenth:
--- Quote from: Chrono on July 12, 2011, 07:03:39 PM ---Or you can type trace(1);, call the function naturally (not through console or script, such as jumping to call onTrigger) It'll show you a list of what it did, in this case it would show Armor::onTrigger(some number less than 4100, some number over 4100, 2, 1) This will always return the second arg then Armor::onTrigger(some number less than 4100, some number over 4100, 2, 0) This will always return 0 From this we can see that: The first one is a datablock. The second one is an object. The third one is probably the slot of the trigger. The forth one is press or release. To find out what kinds of objects these are, for example, if the first number was 44 and the second one was 157083. echo(44.getClassName()); This tells you PlayerData. This means that it's a player datablock. Because this is a player datablock function, the next argument will most likely be the player object, but let's check to make sure. echo(157083.getClassName()); It tells you Player. This means that it is indeed a player object. This means: Armor::onTrigger(datablock, object, slot, value) So then we try to figure out which slot is which. So we trace again, and press in this order: shoot, jet, and crouch. We already know jump is 2. Shoot gave us 0, jet gave us 4, and crouch gave us 3. This means that: 0 = Shoot 2 = Jump 3 = Crouch 4 = Jet There is a trigger for 1, called AltTrigger, but this is unused in Blockland, and is not in your controls by default. The function still exists, but is only able to be used for weapons like akimbo guns, which allows you to shoot just the left gun. Also as a side note, any object ID less than 4100 is a datablock, except for rootGroup (-1), false (0), true (1), and whatever the hell is using the ID 2. --- End quote --- Ah, I see. --- Quote from: Xalos on July 12, 2011, 05:07:47 PM ---Unfortunately, no, unless someone already knows or it gives an error when you use it wrongly. For example, the code "getSubStr();" gives you an error telling you the three variables it uses. However, you CAN package the unknown function and then cause it to be called. package getInfo { function Armor::onTrigger(%a, %b, %c, %d, %e, %f, %g, %h, %i, %j) { %ret = Parent::onTrigger(%a, %b, %c, %d, %e, %f, %g, %h, %i, %j); echo("Armor::onTrigger(\""@%a@"\", \""@%b@"\", \""@%c@"\", \""@%d@"\", \""@%e@"\", \""@%f@"\", \""@%g@"\", \""@%h@"\", \""@%i@"\", \""@%j@") returns \""@%ret@"\""); if(%ret !$= "") return %ret; } }; activatePackage(getInfo); --- End quote --- Alright, I'll try using that. Has anyone made a list of all of these? If not, is it possible to do that? |
| Greek2me:
--- Quote from: Daenth on July 12, 2011, 07:24:55 PM ---Has anyone made a list of all of these? If not, is it possible to do that? --- End quote --- There's no list that I know of right now, but you can just look at other mods for a lot of it if you're not feeling like doing what Chrono just said. |
| Navigation |
| Message Index |
| Next page |