Bobbus Posted May 27, 2010 Author Share Posted May 27, 2010 I found a guide on learning how to press Enter to talk.Basically, this is what it says:1\. Set txtMyTextBox visibility, found in frmMirage, to False.2\. Find, in modGameLogic:``` If (KeyAscii = vbKeyReturn) Then frmMirage.txtMyTextBox.Text = vbNullString If Player(MyIndex).y - 1 > -1 Then If Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).Type = TILE_TYPE_SIGN And Player(MyIndex).Dir = DIR_UP Then Call AddText("The Sign Reads:", BLACK) If Trim$(Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).String1) <> vbNullString Then Call AddText(Trim$(Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).String1), GREY) End If If Trim$(Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).String2) <> vbNullString Then Call AddText(Trim$(Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).String2), GREY) End If If Trim$(Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).String3) <> vbNullString Then Call AddText(Trim$(Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).String3), GREY) End If Exit Sub End If```And Replace with this:``` If (KeyAscii = vbKeyReturn) Then frmMirage.txtMyTextBox.Text = vbNullString If Player(MyIndex).Y - 1 > -1 Then If Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).Type = TILE_TYPE_SIGN And Player(MyIndex).Dir = DIR_UP Then Call AddText("The Sign Reads:", BLACK) If Trim$(Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).String1) <> vbNullString Then Call AddText(Trim$(Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).String1), GREY) End If If Trim$(Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).String2) <> vbNullString Then Call AddText(Trim$(Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).String2), GREY) End If If Trim$(Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).String3) <> vbNullString Then Call AddText(Trim$(Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).String3), GREY) End If Exit Sub Else Call CheckMapGetItem If Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).Type <> TILE_TYPE_ITEM Then If frmMirage.txtMyTextBox.Visible = False Then frmMirage.txtMyTextBox.Visible = True frmMirage.txtMyTextBox.SetFocus Else frmMirage.picScreen.SetFocus frmMirage.txtMyTextBox.Visible = False End If End If End If End If```I've done those things, but I keep getting a "Variable not defined" error, and it highlights:``` frmMirage ```on the line:``` frmMirage.txtMyTextBox.Text = vbNullString ```Any help would be greatly appreciated. Sorry for the stupidity of this question. Link to comment Share on other sites More sharing options...
Robin Posted May 27, 2010 Share Posted May 27, 2010 You do have the project open properly, don't you? Link to comment Share on other sites More sharing options...
Bobbus Posted May 27, 2010 Author Share Posted May 27, 2010 In what ways would it be opened improperly? I just clicked on the Eclipse.vbp and then opened the Form. Link to comment Share on other sites More sharing options...
balliztik1 Posted May 27, 2010 Share Posted May 27, 2010 Given that the error comes from the first line to use "txtMyTextBox", I'd wager you don't have a text box named that. In most Eclipse versions, it's named txtChat or something.Either that, or you mean to point it at frmStable. Either way, those would both throw that error. Link to comment Share on other sites More sharing options...
Bobbus Posted May 27, 2010 Author Share Posted May 27, 2010 Alright, so, basically, here's what it now looks like:``` If (KeyAscii = vbKeyReturn) Then frmStable.txtMyTextBox.Text = vbNullString If Player(MyIndex).Y - 1 > -1 Then If Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).Type = TILE_TYPE_SIGN And Player(MyIndex).Dir = DIR_UP Then Call AddText("The Sign Reads:", BLACK) If Trim$(Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).String1) <> vbNullString Then Call AddText(Trim$(Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).String1), GREY) End If If Trim$(Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).String2) <> vbNullString Then Call AddText(Trim$(Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).String2), GREY) End If If Trim$(Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).String3) <> vbNullString Then Call AddText(Trim$(Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).String3), GREY) End If Exit Sub Else Call CheckMapGetItem If Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).Type <> TILE_TYPE_ITEM Then If frmStable.txtMyTextBox.Visible = False Then frmStable.txtMyTextBox.Visible = True frmStable.txtMyTextBox.SetFocus Else frmStable.picScreen.SetFocus frmStable.txtMyTextBox.Visible = False End If End If End If End If```So, it kind of works. The type-stuff-in box is now gone, and only appears when I press enter. However, when it is open, all my keystrokes are instantly posted. For example, if I type "Red" in the chat box, this is what happens in game:Bobbus:RBobbus:ReBobbus:RedAnd so fourth, for every word.Also, another problem: I can delete text not only in the type-stuff-in box, but also in the chatbox itself, which I do not want.Thanks for the tip with the change frmMirage to Stable, it worked :D Just gotta fix the rest of this stuff and i'll be alll set! Link to comment Share on other sites More sharing options...
Kimimaru Posted May 27, 2010 Share Posted May 27, 2010 @Bobbus:> Also, another problem: I can delete text not only in the type-stuff-in box, but also in the chatbox itself, which I do not want.Your chatbox should be named "txtChat." On frmStable, double-click on it to pull up its code. Make sure its code looks like this:```On Error Resume Next If frmStable.txtMyTextBox.Visible = True Then frmStable.txtMyTextBox.SetFocus End If```Since you've changed when the text box that you type in is visible, you will need to make provisions for the code to only set your mouse pointer focused on it when it is visible by the player. This also makes it so that players cannot edit the chatbox itself. Try fixing that first, and then see if it fixes your other problems. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now