Networking
WITH CLIENT
Run one of the script’s functions on the clients. In a single-player game it runs here.
WITH CLIENT task
with_client(task)
Also documents: args, sync
Parameters
- task AS FUNCTION - A
FUNCTIONof the script’s, by its name.
After !!
- args(values…) - What the function is called with.
- sync(on = TRUE) - Wait until it has run there.
Example
SCREEN 320, 240
FUNCTION greet(name)
PRINT "hello " + name
END FUNCTION
// On every client; in a single-player game, here
WITH CLIENT greet !! args("ada") sync
Notes
It’s also the function with_client, for when you want what it gives back.
WITH PLAYER
Run one of the script’s functions on player slot’s server. In a single-player game it runs here.
WITH PLAYER slot, task
with_player(slot, task)
Also documents: args, sync
Parameters
- slot AS NUMBER
- task AS FUNCTION - A
FUNCTIONof the script’s, by its name.
After !!
- args(values…) - What the function is called with.
- sync(on = TRUE) - Wait until it has run there.
Example
SCREEN 320, 240
FUNCTION award(points)
me.score = points
PRINT "awarded", points
END FUNCTION
// On player 1's server; in a single-player game, here
WITH PLAYER 1, award !! args(50) sync
Notes
It’s also the function with_player, for when you want what it gives back.