Skip to content

Commit eb24c62

Browse files
update scripts and llms-full
1 parent e3982e3 commit eb24c62

7 files changed

Lines changed: 133 additions & 54 deletions

File tree

Example Scripts/chaosCoin.ser

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ $afterText = "<color=white><size=25><b>"
1010
# "coin locked" is a property of this player, storing whether a coin can be used.
1111
# this is because some effects of the coin take time, and we DO NOT want to
1212
# have the coin be used again WHILE a different effect is still ongoing
13-
if {HasPlayerData @evPlayer "coin locked"}
14-
if {GetPlayerData @evPlayer "coin locked"}
15-
Hint @evPlayer 5s "{$hintInfo}You can't use the coin for now!<br><size=20>Come back when the current effect has finished."
16-
IsAllowed false
17-
stop
18-
end
13+
if {GetPlayerData @evPlayer "coin locked"} is true
14+
Hint @evPlayer 5s "{$hintInfo}You can't use the coin for now!<br><size=20>Come back when the current effect has finished."
15+
IsAllowed false
16+
stop
1917
end
2018

2119
# 50% chance to lose the coin

Example Scripts/killStreak.ser

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
# this script adds a custom kill streak counter
22

33
!-- OnEvent Death
4+
-- require @evPlayer
45

5-
if {VarExists @evAttacker} is true
6-
# increment killer's streak
7-
if {HasPlayerData @evAttacker "streak"}
8-
$new = {GetPlayerData @evAttacker "streak"} + 1
9-
else
10-
$new = 1
11-
end
12-
13-
# save the new kill streak
14-
SetPlayerData @evAttacker "streak" $new
15-
16-
# inform attacker of kill
17-
Broadcast @evAttacker 5s "Killstreak: {$new}"
18-
19-
# announce milestone
20-
if $new is 5
21-
Broadcast @all 5s "{@evAttacker -> name} is on a KILLING SPREE (5 Kills)!"
22-
elif $new is 10
23-
Broadcast @all 5s "{@evAttacker -> name} is UNSTOPPABLE (10 Kills)!"
24-
end
6+
SetPlayerData @evPlayer "streak" 0
7+
Broadcast @evPlayer 5s "Your killstreak has been reset!"
8+
9+
if {VarExists @evAttacker} is false
10+
stop
11+
end
12+
13+
# increment killer's streak
14+
$streak = GetPlayerData @evAttacker "streak"
15+
16+
if $streak isnt invalid
17+
$streak = $streak + 1
18+
else
19+
$streak = 1
2520
end
2621

27-
if {VarExists @evPlayer} is true
28-
# reset the victim's streak
29-
SetPlayerData @evPlayer "streak" 0
30-
Broadcast @evPlayer 5s "Your killstreak has been reset!"
22+
# save the new kill streak
23+
SetPlayerData @evAttacker "streak" $streak
24+
25+
# inform attacker of kill
26+
Broadcast @evAttacker 5s "Killstreak: {$streak}"
27+
28+
# announce milestone
29+
if $streak is 5
30+
Broadcast @all 5s "{@evAttacker -> name} is on a KILLING SPREE (5 Kills)!"
31+
elif $streak is 10
32+
Broadcast @all 5s "{@evAttacker -> name} is UNSTOPPABLE (10 Kills)!"
3133
end
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# if a player changes their role, their infection status should be reset
2+
# e.g. role is changed by admin, death, other plugin etc.
3+
4+
!-- OnEvent ChangedRole
5+
-- require @evPlayer
6+
7+
ClearPlayerData @evPlayer date_of_death_by_infection
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# if a player uses a medkit or SCP-500,
2+
# his infection will be cleared
3+
4+
!-- OnEvent UsedItem
5+
-- require @evPlayer *evUsableItem
6+
7+
$type = *evUsableItem -> type
8+
if $type isnt "Medkit" and $type isnt "SCP500"
9+
stop
10+
end
11+
12+
ClearPlayerData @evPlayer date_of_death_by_infection
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# this script is responsible for registering bites of zombies
2+
# and setting the time of death by infection for victims
3+
4+
!-- OnEvent Hurt
5+
-- require @evPlayer @evAttacker
6+
7+
@attacker = @evAttacker
8+
@victim = @evPlayer
9+
10+
# if attacking player is not a zombie -> no infection
11+
if {@attacker -> role} isnt "Scp0492"
12+
stop
13+
end
14+
15+
# cant infect an SCP
16+
if {@victim -> team} is "SCPs"
17+
stop
18+
end
19+
20+
# 50% chance for the victim to get infected
21+
if {Chance 50%}
22+
stop
23+
end
24+
25+
*date = GetPlayerData @victim date_of_death_by_infection
26+
27+
if *date is invalid
28+
# set the date of death to 1 minute in the future
29+
*date = Date.Offset {Date.Current} add 1m
30+
else
31+
# when was bit before, remove 20 seconds from the date
32+
# so the infection happens faster
33+
*date = Date.Offset *date subtract 20s
34+
end
35+
36+
SetPlayerData @victim date_of_death_by_infection *date
37+
38+
Broadcast @victim 7s "You are infected by a zombie - use a medkit or SCP-500 to not turn into a zombie!"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# this script handles infections done by zombie players
2+
# and turning infected players into other zombies
3+
4+
!-- OnEvent RoundStarted
5+
6+
forever
7+
wait 1s
8+
9+
over @all with @plr
10+
wait 1ms
11+
12+
*dateOfDeath = GetPlayerData @plr date_of_death_by_infection
13+
14+
# invalid -> infection date not set -> not infected
15+
if *dateOfDeath is invalid
16+
continue
17+
end
18+
19+
# if the current date is "lower" than the date of death
20+
# it means that the player is not fully infected
21+
if {Date.Current} < *dateOfDeath
22+
continue
23+
end
24+
25+
# now, we initiate the changing into a zombie
26+
27+
# 1) clear the infection status
28+
ClearPlayerData @plr date_of_death_by_infection
29+
30+
# 2) drop inventory so the items dont get lost
31+
ClearInventory @plr drop
32+
33+
# 3) change player to zombie
34+
SetRole @plr Scp0492
35+
end
36+
end
37+
38+
39+

llms-full.md

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Always validate references before using them:
127127
```
128128
*room = @plr -> roomRef
129129
130-
if {*room -> isInvalid}
130+
if *room is invalid
131131
Print "Player is not in a room"
132132
stop
133133
end
@@ -216,22 +216,13 @@ run Func
216216
Print $x # does NOT print 1, as $x was specific to `Func`
217217
```
218218

219-
Preferred way:
219+
Using `with` in loops and functions:
220220
```
221221
over @all with @plr
222222
# @plr only exists here
223223
end
224224
```
225225

226-
Another valid way: (carried over from previous versions)
227-
```
228-
over @all
229-
with @plr
230-
231-
# @plr only exists here
232-
end
233-
```
234-
235226
### Important: Always Verify Global Variables Exist
236227

237228
Never assume a global variable exists. Always check first:
@@ -261,7 +252,7 @@ Negative values don't require parentheses in methods:
261252
$num = -21
262253
TPPosition @fighter -37 313 -140
263254
```
264-
This is because the whitespace seperates these values into different arguments.
255+
This is because the whitespace separates these values into different arguments.
265256

266257
### Percent Sign
267258

@@ -350,9 +341,9 @@ You can use natural language or symbols:
350341
- `<` - less than
351342
- `and` / `&&` - logical AND
352343
- `or` / `||` - logical OR
353-
- `not` / `!` - ILLEGAL, DO NOT USE
354-
> `!` is illegal because SER relies heavily on spaces, providing `!$var` would break the compiler
355-
> `not` is illegal because it could confuse `x isnt y` with `x is not y`
344+
- `not` / `!` - ILLEGAL
345+
> `!` is illegal because heavy relience on spaces
346+
> `not` is illegal because could confuse `x isnt y` with `x is not y`
356347
357348
### Using Properties in Conditions
358349

@@ -636,14 +627,6 @@ end
636627
`OnEvent` flags add variables associated with a given event. (done by reflecting on C#)
637628
But event variables might not always be provided by the C# event:
638629

639-
```
640-
!-- OnEvent Dying
641-
642-
if {VarExists @evAttacker} is false
643-
stop
644-
end
645-
```
646-
or define which are required:
647630
```
648631
!-- OnEvent Dying
649632
-- require @evAttacker
@@ -762,7 +745,7 @@ SER includes several advanced systems you should explore:
762745
- **Use:** Welcome messages, initial setup, tutorial hints
763746
- **Variables:** `@evPlayer` (joining player)
764747

765-
**5. ChangedRole** - `!-- OnEvent ChangedRole` - Triggers when role changes
748+
**5. ChangedRole** - `!-- OnEvent ChangedRole` - Triggers when player's role changes
766749
- **Use:** Role-specific setups, class transitions, spawn effects
767750
- **Variables:** `@evPlayer`, `$evOldRole`, `$evNewRole`
768751

0 commit comments

Comments
 (0)