how to make a command work with custom keywords

sasha2cool
15 Oct 2018, 03:44

im making a game based on a anime, so in a way it would be fan fictional... ahem sorry anway the game is about these doll-sized robots that can play football [soccer].

i want to make the commands like pass ball to [whoever] to where the [] i just said is keyword area... for another robot name, instead of making dozens of commands on the same command,

edit;
ok semi solved.....
im gonna use the tell to thing


jmnevil54
15 Oct 2018, 04:04

Usually the command patterns are something like search #object# or shoot #object#. BTW if you are experimenting, I recommend making your own functions FIRST THING! Use if statements when you are ready to make a new command! I broke my games TWICE because I was messing around with the commands! Online version though. My second game unbroke itself somehow, might have been an update, who knows, in case you are wondering.

And if you are a beginner, I recommend verbs.


hegemonkhan
15 Oct 2018, 04:08

here's a quick brief simple example:


you'd type in during game play:

pass jeff

<object name="soccer_field">
</object>

<object name="ball">

  <attr name="parent" type="object">soccer_field</attr>

</object>

<object name="own_team_object">

  <object name="sasha">

    <attr name="parent" type="object">soccer_field</attr>

  </object>

  <object name="jeff">

    <attr name="parent" type="object">soccer_field</attr>

  </object>

  <own_team_objectlist type="objectlist">

    <value>sasha</value>
    <value>jeff</value>

  </own_team_objectlist>

</object>

<object name="opponent_team_object">

  <object name="hk">

    <attr name="parent" type="object">soccer_field</attr>

  </object>

  <object name="john">

    <attr name="parent" type="object">soccer_field</attr>

  </object>

  <opponent_team_objectlist type="objectlist">

    <value>hk</value>
    </value>john</value>

  </opponent_team_objectlist>

</object>

<command name="pass_command">

  <pattern>pass #object_parameter#</pattern>

  <script>
    old_parent = ball.parent
    if (GetRandomChance (50)) {
      ball.parent = object_parameter
      msg ("You pass the ball from " + old_parent.alias + " to " + object_parameter.alias)
    } else {
      opponent = PickOneObject (opponent_team_object.opponent_team_objectlist)
      ball.parent = opponent
      msg ("You went to pass the ball, but an opposing team member intercepted it. Now they have the ball")
    }
  </script>

</command>

sasha2cool
15 Oct 2018, 04:50

no im not a beginner........
verbs are for the player not objects..... the robots are objects the player is the robot's controller [using commands


mrangel
15 Oct 2018, 07:55

verbs are for the player not objects

Verbs are for objects.
If you want the player to enter "pass ball to [whoever]", then it's equally easy to make a "pass ball to" verb for the other players on your team. It doesn't matter if the player object is involved or not.

Or make a command whose pattern is "pass ball to #object#", which is probably better given that you only have to write the script once.


sasha2cool
15 Oct 2018, 20:25

i think i got it on how it could work...
ill still have to make a dosen with the players name....
but it works.

im going to use the order/tell to thing