Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding Scripted Tile
#1
I was working on this (everything will be hardcoded of course), and I ran into a small snag. I need this:

Code:
If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).Type = TILE_TYPE_SCRIPTED Then
             Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).Data1)
        End If

To run off of a select case, any idea how I would do this?

I seriously doubt I'll be successful in this, but I'd at least like to get this part figured out... :\
Reply
#2
Okay, with a little help from GIAKEN, I managed to get some stuff done. Now I don't have any errors... Nothing just works... xD Heres what I have:

Client
Code:
Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdOk_Click()
    ScriptNum = scrlScript.Value
    Unload Me
End Sub

Private Sub Form_Load()
    If ScriptNum < scrlScript.Min Then ScriptNum = scrlScript.Min
    scrlScript.Value = ScriptNum
End Sub

Private Sub scrlScript_Change()
    lblScript.Caption = scrlScript.Value
End Sub

Code:
Public ScriptNum As Long

Code:
If frmMirage.optscripted.Value Then
                    .Type = TILE_TYPE_SCRIPTED
                    .Data1 = ScriptNum
                    .Data2 = 0
                    .Data3 = 0
                End If

Code:
Case TILE_TYPE_SCRIPTED
                            DrawText TexthDC, ((X * PIC_X) - 4) + (PIC_X * 0.5), ((Y * PIC_Y) - 7) + (PIC_Y * 0.5), "SC", QBColor(Yellow)

Code:
frmScript.Show vbModal

Code:
Public Const TILE_TYPE_SCRIPTED As Byte = 7

SERVER
Code:
If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).Type = TILE_TYPE_SCRIPTED Then
             Call Scripted(Val(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).Data1))
        End If

Code:
Public Const TILE_TYPE_SCRIPTED As Byte =

Code:
Sub Scripted(ByVal scriptnum As Long)
Dim index As Long
Select Case scriptnum

Case 0
    Call PlayerMsg(index, "You're a fag!", Blue)
    Exit Sub
End Select
End Sub

Can anyone see anything wrong, that needs to be changed? I'd be eternally greatful if someone can point out the error. :\ also sorry for the messy code, I'll clean it up in a bit...
Reply
#3
Code:
Sub Scripted(ByVal scriptnum As Long)
Dim index As Long
Select Case scriptnum

Case 0
    Call PlayerMsg(index, "You're a fag!", Blue)
    Exit Sub
End Select
End Sub

You should pass the Index into the sub. Right now your index will always be 0.
Reply
#4
I have:
Code:
If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).Type = TILE_TYPE_SCRIPTED Then
             Call Scripted(Val(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).Data1), index)
        End If

And:
Code:
Sub Scripted(ByVal scriptnum As Long, index As Long)
Select Case scriptnum

Case 0
    Call PlayerMsg(index, "You're a fag!", Blue)
    Exit Sub
End Select
End Sub

Still doesn't work. :\
Reply
#5
Nevermind, I got this done. The problem was where I was placing the check. xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)