Added some more ggsvm_e functionality and also a chat client

This commit is contained in:
Jonatan Pålsson 2011-02-20 01:41:40 +01:00
parent 883cf9e9d7
commit 67567fe263
15 changed files with 1058 additions and 45 deletions

View file

@ -33,9 +33,24 @@ user_command(GameVM, Player, Command, Args) ->
loop(Table) ->
receive
{define, SourceCode} ->
io:format("GameVM_e can't define functions, sorry!~n"),
loop(Table);
{user_command, _User, Command, _Args, _From, _Ref} ->
io:format("GameVM received a message~n"),
ggs_table:notify_all_players(Table, Command),
{user_command, Player, Command, Args, From, _Ref} ->
erlang:display(Player),
do_stuff(Command, Args, Player, Table),
loop(Table)
end.
do_stuff(Command, Args, Player, Table) ->
case Command of
"greet" ->
ggs_player:notify(Player, server, "Hello there!\n");
"chat" ->
ggs_table:notify_all_players(Table, Args ++ "\n");
"uname" ->
Uname = os:cmd("uname -a"),
ggs_player:notify(Player, server, Uname);
Other ->
ggs_player:notify(Player, server, "I don't know that command..\n")
end.