Author Topic: How to make events?  (Read 1440 times)

Hi! I've been wanting to make a speedkart gamemode with item boxes, but I need to learn on how to make events! Please link helpful addons or resources! Thank you!

Don't see what item boxes have to do with events, but ok.

http://forum.blockland.us/index.php?topic=40631.0

Thanks! But how do I make it so the event has output parameters?
It wasn't explained/shown in the thread.

you seemed to have missed this part

Register an Output event:
Code: [Select]
registerOutputEvent(fxDTSBrick, setColorFX, list None 0 Pearl 1 Chrome 2 Glow 3 Blink 4 Swirl 5 Rainbow 6, 0)
registerOutputEvent(fxDTSBrick, disappear, int -1 300 5)
registerOutputEvent(Player, SetPlayerScale, float 0.2 2 0.1 1)
registerOutputEvent(fxDTSBrick, fakeKillBrick, vector^int 0 300 5)
Code: [Select]
registerOutputEvent(%class, %name, %parameterList, %appendClient)
registerOutputEvent("CLASS NAME", "FUNCTION", "argumenttype BOUNDS OR SETTINGS argumenttype BOUNDS OR SETTINGS ...", APPENDCLIENT)

CLASS NAME is the same as the CLASS NAME 2's defined in the last function. When you select one of the Targets, all the outputs for objects with the same class name will show.
FUNCTION is the function called.
The arguments start with a lower case type and the bounds/settings for it after. Multiple settings can be given with tabs. If you set this string to "", there are no arguments. I am guessing these are the arguments passed to the function, starting with the object's ID.
If APPENDCLIENT is set, the triggering client will be added to the end of the arguments.

Known types:
int MININUM MAXIMUM DEFAULT (Integer, must be a whole number but can be below zero)
float MINIMUM MAXIMUM STEPSIZE DEFAULT (Floating point number. Displays a slider which snaps to the nearest (stepsize) amount when you drag it and let go.)
list ITEM returnNo. ITEM returnNo. ITEM returnNo. (Returns returnNo. when the item before it is selected?)
bool (Checkbox)
intList NUMBER (List of integers, separated by spaces. The number is the text box length.)
datablock TYPE (Either a datablock type like ProjectileData or ItemData, shows all ones with uiNames, or something like "Vehicle" or "Music" which shows valid music audioProfiles and all rideable vehicles, including player-based ones like Horses)
string CHARACTERS LENGTH (Displays a text box of length LENGTH which can hold up to CHARACTERS letters or numbers)
vector (Displays three boxes which let you input a 3d vector)
paintColor 0 (Displays a selector for a paint colour type. I am not sure what function the 0 has.)
looks like you just type it out, commas probably separate arguements

looks like you just type it out, commas probably separate arguements
No. Tabs do.

Multiple settings can be given with tabs.
my bad, meant commas separate the different values (target/name/input values)

wait, I am so confused,
Code: [Select]
function fxDTSBrick::onPlayerTouchRandom,(%brick)
{
 
}
registerOutputEvent(%class, %name, %parameterList, %appendClient)
registerOutputEvent("CLASS NAME", "FUNCTION", "intList 3", APPENDCLIENT)
registerInputEvent("fxDTSBrick","OnPlayerTouchRandom","Self fxDTSBrick Player Player Client GameConnection");
im not working on the code right now, I just want the event to appear
but its not (as usual)
was I supposed to tab it?

try just this?
Code: [Select]
function fxDTSBrick::onPlayerTouchRandom(%brick)
{
 
}
registerInputEvent("fxDTSBrick","OnPlayerTouchRandom","Self fxDTSBrick Player Player Client GameConnection");

but really, please tell us what you're trying to do
i'm not sure why you're making an input event instead of an output event

try just this?
-snip-
Nice spoon you have there, very fancy.


You should take a look at an add-on which does something similar to what you want. Unfortunately OnPlayerTouch is in the encrypted .dso files, so you cant look at that, but there are plenty of event add-ons. Take a look at those, try to find out how they work on your own. You'll learn a lot more and a lot better that way.
If you do have trouble understanding a specific part, ask here. Nobody likes general "how do I do this?" topics, because it shows you have not tried to do it yourself.

can someone tell me what the parameters are in registeroutputevent and registerinputevent?
also, can you make an example event having something to do with named brick?
« Last Edit: September 04, 2015, 01:58:31 PM by -Setro- »

can someone tell me what the parameters are in registeroutputevent and registerinputevent?
function registerInputEvent(%class, %name, %targetList, %adminOnly)
function registerOutputEvent(%class, %name, %parameterList, %appendClient)

The target "named brick" is added automatically, you don't have to worry about it basically

Nice spoon you have there, very fancy.


You should take a look at an add-on which does something similar to what you want. Unfortunately OnPlayerTouch is in the encrypted .dso files, so you cant look at that, but there are plenty of event add-ons. Take a look at those, try to find out how they work on your own. You'll learn a lot more and a lot better that way.
If you do have trouble understanding a specific part, ask here. Nobody likes general "how do I do this?" topics, because it shows you have not tried to do it yourself.
Thanks for the comment.
Edit: My internet is not allowing me to download Event addons. Its a 444 error, I hope it will be back soon
« Last Edit: September 04, 2015, 03:12:46 PM by Bow »

it seems like you'd want to make an output event, so like onitempickup(already made(?))>player>giverandomitem
and then that would remove the box item that's on the track from their inventory and swap it with a random item of your choosing

Nice spoon you have there, very fancy.
my spoon only pressed backspace :cookieMonster:

it seems like you'd want to make an output event, so like onitempickup(already made(?))>player>giverandomitem
and then that would remove the box item that's on the track from their inventory and swap it with a random item of your choosing
my spoon only pressed backspace :cookieMonster:
Yep, you got most of it right, I know I will need getRandom. in the code.
But the thing I want is that the box thingy is not a pickup item, but rather, a brick.

onplayertouch>player>giverandomitem
onplayertouch>self>seteventsenabled[0 1 2][0]
onplayertouch>self>seteventsenabled[0 1 2][1] - delayed

something like that?
the last two lines are pretty good for a timeout
if you're worried about saving incorrectly, throw in a 4th line onminigamereset>self>seteventsenabled[0 1 2][1]

can also swap out onplayertouch with other inputs like onactivate, depending on how you want the input to be (because you still won't tell us)