(resolved)Command issue

Alright so here is the issue I am having. The command input I have is as follows > this command allows me to add a specific object that is parented to the game and adds it to the player's inventory and then removes another object the player is currently holding. So for this example, I have a seed it will remove the seed and give me the apple. So the issue is I link the player to this command prompt, they would click on the prompt. The seed gets removed, the apple gets added and then the command prints this ">>"(ignore the "") can anyone explain to me how I can keep the command from printing its own prompt. Also is there a way to keep a user from abusing the command prompt I don't want my users infinitely adding and removing apples whenever they want.
(I found out how to fix it, thank you pixie and everyone else for helping me out.)


I'm not quite sure what you mean. This sounds like an easy answer (if I am interpreting your question correctly) but I'm confused by your question. What do you mean "...I link the player to the command prompt..."? In your description of your problem I am not sure I understand your use of the words "link" and "command prompt". Try to clarify OR copy-paste the bit of code that you are having troubles with. Good luck.


"... can anyone explain to me how I can keep the command from printing its own prompt... (Anthony)"

conditions, via the 'if' Script, for an example:

// animal = "deer"

if (animal = "deer") {
  msg ("ah, what a cute deer!")
} else if (animal = "lion") {
  msg ("Oh.... $hit!!!!!!!!!!!!")
} else {
  // [BLANK/NOTHING/NULL]
}

// output: ah, what a cute deer!

----------------

// animal = "lion"

if (animal = "deer") {
  msg ("ah, what a cute deer!")
} else if (animal = "lion") {
  msg ("Oh.... $hit!!!!!!!!!!!!")
} else {
  // [BLANK/NOTHING/NULL]
}

// output: Oh.... $hit!!!!!!!!!!!!

-------------

// animal = "bird"

if (animal = "deer") {
  msg ("ah, what a cute deer!")
} else if (animal = "lion") {
  msg ("Oh.... $hit!!!!!!!!!!!!")
} else {
  // [BLANK/NOTHING/NULL]
}

// output: [BLANK/NOTHING/NULL]

How can the player misuse the command prompt to get more apples?
If you take 1 seed away and give the player 1 apple, when they have no seeds, they can't get an apple...
Unless you are not preventing the player to trade seeds they don't have.


" Also is there a way to keep a user from abusing the command prompt I don't want my users infinitely adding and removing apples whenever they want. (Anthony)"

same way, for example:

// enabled = false

if (enabled) {
  // add/remove apple
} else {
  msg ("Sorry, but you can't add/remove an apple currently right now")
}

// output/result: Sorry, but you can't add/remove an apple currently right now

-------------

// enabled = true

if (enabled) {
  // add/remove apple
} else {
  msg ("Sorry, but you can't add/remove an apple currently right now")
}

// output/result: [ACTION: add/remove apple]

// player.apple_quantity = 3

if (player.apple_quantity < 5) {
  // add apple
  player.apple_quantity = player.apple_quantity + 1
} else {
  msg ("Sorry, but you can only be carrying 5 apples at a time")
}

// output/result: [ACTION: add apple and increase 'player.apple_quantity' by 1]

--------

// player.apple_quantity = 5

if (player.apple_quantity < 5) {
  // add apple
  player.apple_quantity = player.apple_quantity + 1
} else {
  msg ("Sorry, but you can only be carrying 5 apples at a time")
}

// output/result: Sorry, but you can only be carrying 5 apples at a time

Alright so here the code to better explain what is happening
If player is carrying object Mind
then
add to inventory mind 1
remove object mind 0
that's what currently functions correctly
the way the player adds the item is through the command prompt : {command: >} So the player clicks on the command link right? So it should just add the item but in the game
this appears: >> (there is no print message telling the command to do so, there is nothing that should be showing the player this, the item is still added to the inventory but this appears)
So the best example I can give is
DecreaseIIncrease {command:>} (they click on it)
(>>)*
(this shows up but shouldn't)*


The player is able to misuse the prompt because these stats affect dialogue and the ways things work in the game. I don't want the player editing their stats unless I allow them to.


You can tell Quest whether to show the commands with the echocommand attribute of the game object. Before printing the command to screen, add this code:

game.echocommand = false

After the player has done that bit:

game.echocommand = true

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums