1 (edited by Ferret 2009-06-01 04:56:45)

Topic: Keys input

Hi,

I created a server and a client with accounts and chat working.
Now i want to use Irrlich as 3D engine but the BMax input commands for keys don't work.

How do i get input for a simple chat and movement?

These are the commands i need for the chat to work as is,

Chr()
GetChar()
KeyHit()
FlushKeys()

Thx,

Re: Keys input

This is the code.

Function UpdateConsole()
   
    Local key%
    Local chatMsg$
    'Local extension$ = "_"
   
    key = GetChar()
   
    If key >= 32 And key <= 126
        chat = chat + Chr(key)
    EndIf
   
    If key = 8 Then If chat <> "" Then chat = Left(chat, Len(chat) - 1)
   
    If key = 13 Then
        'Info("<green>" + localPlayer\Name + " : " + chat)
        'BP_Message (0,localPlayer\id,msgChat,chat,True)
        If chat <> ""
            AddTxt playername + " : " + chat
            chatMsg = Chr(ID_CHAT) + playername + " : " + chat
            If Online = True Then RN_Send(peer, chatMsg$, Len(chatMsg$) + 1, HIGH_PRIORITY, RELIABLE_ORDERED, 0, RN_GetSystemAddressFromIndex(peer, 0), False)
        EndIf
        chat = ""
        Chatting = False
    End If
   
    If MilliSecs() > chattimer
        If extension = "_"
            extension = ""
            'chattimer = MilliSecs() + 1000
        ElseIf extension = ""
            extension = "_"
            'chattimer = MilliSecs() + 1000
        EndIf
        chattimer = MilliSecs() + 500
    EndIf

    DrawText chat + extension ,20,GraphicsHeight() - 20
   
End Function

Re: Keys input

Re: Keys input

I think that is what i need but i get a error when i import Irrlicht.Addons,

Linking:15.loadirrfile.debug.exe
C:/Program Files/BlitzMax/mod/irrlicht.mod/addons.mod/addons.debug.win32.x86.a(addons.bmx.debug.win32.x86.o): undefined reference to `_irrlicht_core_SMaterial_create'
Build Error: Failed to link D:/MaxDev/irrlicht_examples/examples/15.LoadIrrFile/15.loadirrfile.debug.exe
Process complete

Is ist posible to get what key was pressed like GetChar(), instead of cycling trough all posible keys?

Re: Keys input

greetings smile  the mod needed recompile for v1.5 of Irrlicht.  it also did not have a GetChar equivalent.  please download the newest version. 

you should be able to use Chr() straight from BMAX.  for the rest use the following methods on SmoothEventReciever:

GetChar() => PopKey()
KeyHit() => KeyHitCnt()
FlushKeys() => FlushKeys()

6 (edited by Ferret 2009-06-14 04:43:11)

Re: Keys input

Thx Gman,

For mi curent project i'm using MiniB3D because its easy to get in to if you know Blitz3D.

But, i'm going to keep playing with the Irrlicht mods untill i know enough to make a game with it.
I see this as the next step in mi game making adventures, but its still to advanced for me to create a full game with.
The info i got so far and the eamples are great.

And all these great mods for free, you got mi full support!

Thx again