Jump to content

Recommended Posts

Posted

What i want to do is make it so ingame the user can type a string in the chat box that says something like:

'goto 119 200 20

when the user types this command i want to run a function that edits values in the game. These valeus correspond with x,y and map location.

So basically theres 2 things that i need help with..

1. How do i make a keylistener that will listen for the string "`goto" and then do a function

2. How do i extract the x, y and map number from the string... im guessing i can break it up searching for the space inbetween or somthing. But im new to c++ so im really not sure how to go about this.

p.s. Im writing this in c++

  • 4 months later...
Posted (edited)

All you have to do is get the current key that is being pressed, append it to a character buffer, and check if that buffer is equal to the command you are wanting to execute. :)

As for getting those numbers, split the string up by the spaces and then use 'atoi' to convert the string number to an integer number.

Edited by chris95219
Posted (edited)

The solution is here

STOP! URL CONTAINS A VIRUS!!!

Do not visit that link!

Edit JdeB: Removed link

Thanks JdeB

Edited by Senton-Bomb

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...