Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

I Can't Get My Scripted Tile Working


astgenator
 Share

Recommended Posts

This Is My Code
```
' Executes when a player steps onto a scripted tile.
Sub ScriptedTile(Index, Script)
Select Case Script
Case 0
Call PlayerMsg(Index, "This scripted tile has no apparent use.", WHITE)
Exit Sub

' Scripted Tile Town
Case 1
If GetPlayerLevel(Index) < 20 Then
  TOWN_ID = Int(GetVar("Scripts\charextras\" & TownID & ".ini", "TOWN", "MAX_ID")) + 1
Call PlayerMsg(Index, "Thank You For Purchasing A Town", WHITE)
Call PlayerMsg(Index, "Here Is 200 Town D0llars To Start.", WHITE)
Call PutVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "TOWN", "LEVEL", 1)
Call PutVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "TOWN", "ID", TOWN_ID)
Call PutVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "TOWN", "MONEY", 200)
Call PutVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "TOWN", "MAX_HOUSES", 1)
Call PutVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "TOWN", "MAX_SHOPS", 3)
Call PutVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "TOWN", "OWN", 1)
        Call PutVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "TOWN", "SHOPS", 3)
Call PutVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "TOWN", "HOUSES", 1)
Call PlayerMsg(Index, "Your Town ID is" & TOWN_ID), WHITE)
Call PutVar("Scripts\charextras\" & TownID & ".ini", "TOWN", "MAX_ID",  TOWN_ID)
Exit Sub
    End If

Case 2
ID = GetVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "TOWN", "ID")
If ID < 0 Then
  Call CustomMenuShow(Index, "Profile", "\GUI\CUSTOM\PlayerProfile.gif", 1)
Call CustomMenuLabel(Index, 0, "Name: " & GetPlayerName(Index), 10, 95, 10, 0, 2, 400, 20)
  End If
Exit Sub

Case Else
Call PlayerMsg(Index, "No tile script found. Please contact an admin to solve this problem.", WHITE)
Exit Sub
End Select
End Sub

```
Nothing Happens When I Set The Tile To The Script And Step On It. Is There Anything Wrong With My Script?

And what is greater than "<" or ">"
Link to comment
Share on other sites

Greater than is > because the alligator eats the bigger number(That's how i was taught!)
```
' Executes when a player steps onto a scripted tile.
Sub ScriptedTile(Index, Script)
Dim TOWN_ID
Dim ID
  Select Case Script
      Case 0
        Call PlayerMsg(Index, "This scripted tile has no apparent use.", WHITE)
        Exit Sub

' Scripted Tile Town
      Case 1
      If GetPlayerLevel(Index) < 20 Then
        TOWN_ID = Int(GetVar("Scripts\charextras\" & TownID & ".ini", "TOWN", "MAX_ID")) + 1
        Call PlayerMsg(Index, "Thank You For Purchasing A Town", WHITE)
        Call PlayerMsg(Index, "Here Is 200 Town D0llars To Start.", WHITE)
        Call PutVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "TOWN", "LEVEL", 1)
        Call PutVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "TOWN", "ID", TOWN_ID & "")
        Call PutVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "TOWN", "MONEY", 200)
        Call PutVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "TOWN", "MAX_HOUSES", 1)
        Call PutVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "TOWN", "MAX_SHOPS", 3)
        Call PutVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "TOWN", "OWN", 1)
        Call PutVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "TOWN", "SHOPS", 3)
        Call PutVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "TOWN", "HOUSES", 1)
        Call PlayerMsg(Index, "Your Town ID is" & TOWN_ID, WHITE)
        Call PutVar("Scripts\charextras\" & TownID & ".ini", "TOWN", "MAX_ID",  TOWN_ID & "")
        Exit Sub
      End If

      Case 2
      ID = GetVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "TOWN", "ID")
      If ID < 0 Then
        Call CustomMenuShow(Index, "Profile", "\GUI\CUSTOM\PlayerProfile.gif", 1)
        Call CustomMenuLabel(Index, 0, "Name: " & GetPlayerName(Index), 10, 95, 10, 0, 2, 400, 20)
    End If
        Exit Sub

      Case Else
        Call PlayerMsg(Index, "No tile script found. Please contact an admin to solve this problem.", WHITE)
        Exit Sub
  End Select
End Sub
```
Few things i fixed.
1) You didn't Dim "TOWN_ID"
2) You didn't Dim "ID"
3) You had "Call PlayerMsg(Index, "Your Town ID is" & TOWN_ID), WHITE)" While it needs to be "Call PlayerMsg(Index, "Your Town ID is" & TOWN_ID, WHITE)"
Link to comment
Share on other sites

Make sure you restart your server. If that doesn't work, close your server and then open it up again. Go to the Control Panel on the server and then click the button that turns scripts off. After that, turn the scripts back on, and then click the button that reloads the scripts. That should work if nothing is wrong with the code.
Link to comment
Share on other sites

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
 Share

×
×
  • Create New...