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

Script cases


teh jimpie
 Share

Recommended Posts

Hello,

I need some help with placing this script, i fail at timers -.-

In sub tmrtest
```

Sub tmrTest(Index, script)
'====================================

Dim Guildname
Dim Charnum
Dim Login
Dim Max
On Error Resume Next
Select Case Script

Case 0
If Getvar("scripts\Charextras\" & GetPlayerName(index) & ".ini", "Status", "Freeze") = "1" then
Call LockPlayer(index, 0)
call playermsg(index, "Now you can move again!", 10)
Call RemoveTimer("tmrtest " & index & "," & 3)
End If

End Select
End Sub
```
in scripted spells:
```
target = GetplayerTarget(index)
If target > 0 Then
Call Putvar("scripts\Charextras\" & GetPlayerName(target) & ".ini", "Status", "Freeze", "1")
Call SetTimer("tmrtest " & target & "," & 3, 20000)
Call LockPlayer(target, 1)
Call LockSpells(target, 1)
Call LockItems(target, 1)
Call LockAttack(target, 1)
Call playermsg(target, "You have been frozen!", 4)
Else
Exit Sub
End If
```
It actually gives error, something with the "close" too, (end if, exit sub i think)
please help me.
Link to comment
Share on other sites

Hello

Replace the tmrtest with this:

```

Sub tmrTest(Index, script)
'====================================

Dim Guildname
Dim Charnum
Dim Login
Dim Max
On Error Resume Next

Select Case Script

Case 0
If Getvar("Scripts\Charextras\" & GetPlayerName(index) & ".ini", "Status", "Freeze") = "1" Then
Call LockPlayer(Index, 0)
call playermsg(Index, "Now you can move again!", 10)
Call RemoveTimer("tmrtest " & Index & "," & 3)
End If
Exit Sub

End Select
End Sub

```
Your didn't put a capital letter for "Then", nor an "Exit Sub" terminator after the "Case" statement.

Nowe replace the scripted spell with:

```

Dim target
target = GetplayerTarget(index)
If target > 0 Then
Call Putvar("Scripts\Charextras\" & GetPlayerName(target) & ".ini", "Status", "Freeze", "1")
'NOT SURE WHY YOU ARE CALLING SCRIPT 3 HERE WHEN YOU DON'T HAVE A SCRIPT 3 CASE IN YOUR TIMER SUB THAT YOU POSTED
'CHECK THAT YOU MEAN SCRIPT 3 OTHERWISE THIS MAY CAUSE AN ERROR
Call SetTimer("tmrtest " & target & "," & 3, 20000)
Call LockPlayer(target, 1)
Call LockSpells(target, 1)
Call LockItems(target, 1)
Call LockAttack(target, 1)
Call playermsg(target, "You have been frozen!", 4)
Else
Exit Sub
End If

```
Let me know if this fixes that error!

Yours sincerely
cloudwolf00
Link to comment
Share on other sites

Ye, not sure about case 3 -.-

my questions was actually about the "cases" =.= see title of this topic.

again; i edit the scripts abit too.
```
Case 29

If CanTake(Index, 103, 6) And CanTake(Index, 106, 4) And CanTake(Index, 107, 2) = True Then
target = GetplayerTarget(index)
If target > 0 Then

Call Putvar("Scripts\Charextras\" & GetPlayerName(target) & ".ini", "Status", "Freeze", "1")
Call SetTimer("tmrtest " & target & "," & 3, 20000)
Call LockPlayer(target, 1)
Call playermsg(target, "You have been frozen!", 4)
        Call TakeItem(Index, 103, 6)
        Call TakeItem(Index, 106, 4)
        Call TakeItem(Index, 107, 2)
End If
End If
Exit Sub
```
And; do i have to make for sub tmrtest a new .ess file and put it in that, or just in my main.ess. I prefer in a new .ess file if thats possible (not if you got to do alot other things)
```
Sub tmrTest(Index, script)
'====================================

Dim Guildname
Dim Charnum
Dim Login
Dim Max
On Error Resume Next

Select Case Script

Case 0
If Getvar("Scripts\Charextras\" & GetPlayerName(index) & ".ini", "Status", "Freeze") = "1" Then
Call LockPlayer(Index, 0)
call playermsg(Index, "Now you can move again!", 10)
Call RemoveTimer("tmrtest " & Index & "," & 3)
End If
Exit Sub

End Select
End Sub
```
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...