mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2024-12-28 07:45:29 +03:00
Updated VScript : Basic I:O Tutorial (markdown)
parent
3799bb2d54
commit
69bd6b85e2
@ -94,7 +94,7 @@ If this does not work, check the steps above and make sure you followed them cor
|
|||||||
|
|
||||||
### 6. Conclusion
|
### 6. Conclusion
|
||||||
|
|
||||||
You have now written a basic script file which interacts with the I/O system. This tutorial was meant to give a simple interpretation of what VScript can do. The function we wrote was very simple and not very useful alone, but it's a starting point for more complicated coding.
|
You have now written a basic script file which interacts with the I/O system. This tutorial was meant to give a simple interpretation of what VScript can do. The function we wrote was very simple and not very useful alone, but it's a starting point for more complicated logic.
|
||||||
|
|
||||||
For example, this is the script we used in the tutorial:
|
For example, this is the script we used in the tutorial:
|
||||||
|
|
||||||
@ -112,14 +112,12 @@ function SetPlayerHealthToRandom()
|
|||||||
{
|
{
|
||||||
local health = RandomInt( 55, 85 )
|
local health = RandomInt( 55, 85 )
|
||||||
EntFire("!player", "SetHealth", health)
|
EntFire("!player", "SetHealth", health)
|
||||||
|
|
||||||
printl("Set player health to " + health)
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
This slightly different function, `SetPlayerHealthToRandom`, sets the player's health to a random number in between `55` and `85`, also printing the result to the console.
|
This slightly different function, `SetPlayerHealthToRandom`, sets the player's health to a random number in between `55` and `85`.
|
||||||
|
|
||||||
That is a peek at some of the more complicated logic you can use in VScript, where it actually becomes proper programming. There's even a way to set the player's health without using the I/O system at all.
|
That is a peek at some of the more complicated logic you can use in VScript, where it actually becomes proper coding. There's even a way to set the player's health without using the I/O system at all.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user