Skip to content

Commit

Permalink
Improve guides, examples, and templates
Browse files Browse the repository at this point in the history
+ Help see where the `BotEvent` and `BotResponse` symbols are coming from: Remove the abbreviations in the bot code.
+ Update the catalog tags on the bots.
+ Update the guide: The name consistency issue was resolved with commit faf59c8.
  • Loading branch information
Viir committed Aug 6, 2019
1 parent d423d2d commit 9d4a765
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
6 changes: 0 additions & 6 deletions guide/how-to-develop-eve-online-bots.md
Expand Up @@ -78,12 +78,6 @@ Thanks to the translation in the wrapping function discussed above, the types he

> The actual names for the types used here are only conventions. You might find a bot code which uses different names. For example, the bot author might choose to abbreviate `InterfaceToHost.BotEvent` to `BotEvent`, by using a type alias.
```todo
-> TODO:
+ Update the example bots and devtools for consistent names.
+ Look into improving type names for more consistency (`BotEventResponse`?)
```

I will quickly break down the Elm syntax here: The part after the last arrow (`->`) is the return type. It is a tuple with two components. The part between the colon (`:`) and the return type is the list of parameters. So we have two parameters, one of type `InterfaceToHost.BotEvent` and one of type `State`.

Let's have a closer look at the three different types here:
Expand Down
12 changes: 6 additions & 6 deletions implement/bot/devtools/read-from-image/src/Bot.elm
Expand Up @@ -14,7 +14,7 @@
> Found matches in 4 locations:
> [ { x = 23, y = 57 }, { x = 33, y = 57 }, { x = 43, y = 57 }, { x = 53, y = 57 } ]
bot-catalog-tags:demo,test,locate-object-in-image
bot-catalog-tags:devtool,test,locate-object-in-image
-}


Expand All @@ -27,7 +27,7 @@ module Bot exposing
import Base64.Decode
import DecodeBMPImage exposing (DecodeBMPImageResult, PixelValue)
import Dict
import Interface_To_Host_20190803 as InterfaceToHost exposing (BotEvent, BotResponse(..))
import Interface_To_Host_20190803 as InterfaceToHost
import Json.Decode
import Maybe.Extra
import VolatileHostSetup exposing (ReadFileContentResultStructure(..), RequestToVolatileHost(..), ResponseFromVolatileHost(..))
Expand Down Expand Up @@ -163,7 +163,7 @@ initState =
}


processEvent : BotEvent -> State -> ( State, BotResponse )
processEvent : InterfaceToHost.BotEvent -> State -> ( State, InterfaceToHost.BotResponse )
processEvent eventAtTime stateBefore =
let
state =
Expand All @@ -183,12 +183,12 @@ processEvent eventAtTime stateBefore =
response =
case nextStep of
StopWithResult { resultDescription } ->
FinishSession
InterfaceToHost.FinishSession
{ statusDescriptionForOperator = generalStatusDescription ++ "Stopped with result: " ++ resultDescription
}

ContinueWithTask continue ->
ContinueSession
InterfaceToHost.ContinueSession
{ startTasks = [ continue.task ]
, statusDescriptionForOperator = generalStatusDescription ++ "Current step: " ++ continue.taskDescription
, notifyWhenArrivedAtTime = Nothing
Expand All @@ -197,7 +197,7 @@ processEvent eventAtTime stateBefore =
( state, response )


integrateEvent : BotEvent -> State -> State
integrateEvent : InterfaceToHost.BotEvent -> State -> State
integrateEvent event stateBefore =
case event of
InterfaceToHost.ArrivedAtTime configuration ->
Expand Down
Expand Up @@ -2,7 +2,7 @@
It takes any configuration string received from the user and stores it in the bot state.
This bot also updates the status message to show the last received bot configuration, so you can check that a method (e.g., via command line) of setting the bot configuration works.
bot-catalog-tags:guide,demo-botengine
bot-catalog-tags:guide,demo-interface-to-host
-}


Expand All @@ -12,7 +12,7 @@ module Bot exposing
, processEvent
)

import Interface_To_Host_20190803 as InterfaceToHost exposing (BotEvent, BotResponse)
import Interface_To_Host_20190803 as InterfaceToHost
import Json.Encode


Expand All @@ -27,7 +27,7 @@ initState =
{ timeInMilliseconds = 0, lastSetConfiguration = Nothing }


processEvent : BotEvent -> State -> ( State, BotResponse )
processEvent : InterfaceToHost.BotEvent -> State -> ( State, InterfaceToHost.BotResponse )
processEvent event stateBefore =
let
state =
Expand All @@ -42,7 +42,7 @@ processEvent event stateBefore =
)


integrateEvent : BotEvent -> State -> State
integrateEvent : InterfaceToHost.BotEvent -> State -> State
integrateEvent event stateBefore =
case event of
InterfaceToHost.ArrivedAtTime { timeInMilliseconds } ->
Expand Down

0 comments on commit 9d4a765

Please sign in to comment.