Skip to content

Commit 680467e

Browse files
committed
update dialog box doc
1 parent 0f7ce9b commit 680467e

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

_doc/stdlib/dialogbox.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Dialog Box
33
layout: stdlibdoc
44
color: blue
5-
date: 2019-02-04
5+
date: 2025-01-15
66
sections:
77
- /stdlib/util/dialogbox
88
---

_doc/stdlib/util/dialogbox.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,22 @@ sections:
1212
In warcraft III a dialog refers to a modal dialog that is shown to players with a message text and various buttons to click.
1313
Dialogs have several drawbacks, such as disabling user input and chat, and thus should only be seldomly used in multiplayer.
1414

15+
> Dialogs cannot be created during map init!
16+
1517
### The DialogBox
1618

1719
If you want to create a dialog though, make use of the `DialogBox` class. You can eiher reuse the same `DialogBox` and use `GetTriggerPlayer()` to get the player in the click event:
1820

1921
```wurst
2022
init
21-
let dBox = new DialogBox("Are you a noob?")
22-
dBox.addButton("Yes") ->
23-
GetTriggerPlayer()..addGold(500)..display(GetTriggerPlayer(), false)
24-
25-
dBox.addButton("No", () -> dBox.display(GetTriggerPlayer(), false))
26-
23+
// Can't create Dialogs during map init
2724
doAfter(0.1) ->
28-
// Don't call display during init
25+
let dBox = new DialogBox("Are you a noob?")
26+
dBox.addButton("Yes") ->
27+
GetTriggerPlayer()..addGold(500)
28+
dBox.display(GetTriggerPlayer(), false)
29+
30+
dBox.addButton("No", () -> dBox.display(GetTriggerPlayer(), false))
2931
for i = 0 to 11
3032
dBox.display(players[i], true)
3133
```
@@ -34,12 +36,14 @@ init
3436
Example with global and display on spellcast:
3537

3638
```wurst
37-
constant GOLD_BOX = new DialogBox("Extra starting gold?")
39+
DialogBox goldBox
3840
3941
init
40-
// add buttons
41-
dBox.addButton("Yes") ->
42-
...
42+
doAfter(0.1) ->
43+
goldBox = new DialogBox("Extra starting gold?")
44+
// add buttons
45+
dBox.addButton("Yes") ->
46+
...
4347
4448
EventListener.onCast(SPELL_ID) (caster) ->
4549
GOLD_BOX.display(caster, true)

_sass/doc.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
.doc-header {
3131
margin-bottom: 48px;
32+
margin-top: 48px;
3233
.doc-title {
3334
color: var(--color-primary);
3435
margin-top: 0;

0 commit comments

Comments
 (0)