1:- module(testmudconsole, [age/1, flag_table/0, simple_stuff/1]). 2
3:- use_module('mudconsole/mudconsole'). 4
5:- use_module(swi(library/http/html_write)). 6
7start_webclient:- mc_start([title('Logicmoo MUD'), allow(_)]).
13age(Age) :-
14 mc_ask(
15 [ age(Age, between(0,120)) ],
16 [ p(['How old are you? ', input([name(age)])])
17 ]).
23flag_table :-
24 findall(Flag-Value, current_prolog_flag(Flag,Value), Pairs),
25 keysort(Pairs, Sorted),
26 mc_html(mc_output, table(class(flags),
27 [ tr([th('Flag'), th('Value')])
28 | \rows(Sorted)
29 ]), [clear(true)]).
30
31rows([]) --> [].
32rows([H|T]) --> row(H), rows(T).
33
34row(Flag-Value) -->
35 html(tr([td(class(flag), Flag),
36 td(class(value), '~q'-[Value])
37 ])).
38
39
40simple_stuff(X) :-
41 mc_html(mc_output, h1(X) , [clear(true)])