Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding SadScript Support
#51
Really? Oops, sorry about that.
Yes, as Advocate said, I am making a game engine.
Reply
#52
Got past that file not found error, now im having this error.. Sad

Code:
ReDim Preserve sAllCode(UBound(sAllCode) - 1)       'Get rid of last array element (which is blank)

Subscript out of range (RTE 9)
Reply
#53
Fixed all my bugs but nothing in the main.txt is working ;(.

Heres my main.txt Sad

Code:
Sub JoinGame(index)
Dim GameName
Dim MOTD

MOTD = GetVar("motd.ini", "MOTD", "Msg")

    ' Send a global message that he/she joined
    If GetPlayerAccess(index) >= ADMIN_MONITER Then
        Call GlobalMsg(GetPlayerName(index) & " an Administrator, has joined " & GameName & "!", 7)
    Else
        Call GlobalMsg(GetPlayerName(index) & " has joined " & GameName & "!", 15)
    End If

    ' Send them welcome
    Call PlayerMsg(index, "Welcome to " & GameName & "!", 15)
    
    ' Send motd
    If Trim(MOTD)  "" Then
        Call PlayerMsg(index, "MOTD: " & MOTD, 11)
    End If
End Sub

Sub LeftGame(index)
Dim GameName
Dim n


    ' Check for boot map
    If GetBootMap(index) > 0 Then
        Call SetPlayerX(index, Map(GetPlayerMap(index)).BootX)
        Call SetPlayerY(index, Map(GetPlayerMap(index)).BootY)
        Call SetPlayerMap(index, Map(GetPlayerMap(index)).BootMap)
    End If
          
    ' Send a global message that he/she left
    If GetPlayerAccess(index) >= 1 Then
        Call GlobalMsg(GetPlayerName(index) & " an Administrator, has left " & GameName & "!", 7)
    Else
        Call GlobalMsg(GetPlayerName(index) & " has left " & GameName & "!", 15)
    End If
End Sub

Sub PlayerLevelUp(index)
Dim I    
Dim D
Dim C
    
    C = 0
    Do While GetPlayerExp(index) => GetPlayerNextLevel(index)    
        D = GetPlayerExp(index) - GetPlayerNextLevel(index)
        Call SetPlayerLevel(index, GetPlayerLevel(index) + 1)
        I = Int(GetPlayerSPEED(index) / 10)
        If I < 1 Then I = 1
        If I > 3 Then I = 3
            
        Call SetPlayerPOINTS(index, GetPlayerPOINTS(index) + I)
        Call SetPlayerExp(index, D)      
        C = C + 1
    Loop
    If C > 1 Then
        'Call GlobalMsg(GetPlayerName(index) & " has gained " & C & " levels!", 6)
    Else
        'Call GlobalMsg(GetPlayerName(index) & " has gained a level!", 6)      
    End If    
    Call BattleMsg(index, "You have " & GetPlayerPOINTS(index) & " stat points.", 9, 0)  
End Sub

Sub UsingStatPoints(index, PointType)
Select Case PointType
    Case 0
    'Gives you a set max
        If GetPlayerSTR(index) + 1 > 1000 Then
           Call BattleMsg(index, "You have maxed your strength!", 12, 0)
           Exit Sub
        End If
        Call SetPlayerSTR(index, GetPlayerSTR(index) + 1)
        Call BattleMsg(index, "You have gained more strength!", 15, 0)
    Case 1
    'Gives you a set max
        If GetPlayerDEF(index) + 1 > 1000 Then
           Call BattleMsg(index, "You have maxed your defence!", 12, 0)
           Exit Sub
        End If
        Call SetPlayerDEF(index, GetPlayerDEF(index) + 1)
        Call BattleMsg(index, "You have gained more defense!", 15, 0)
    Case 2
    'Gives you a set max
        If GetPlayerMAGI(index) + 1 > 1000 Then
           Call BattleMsg(index, "You have maxed your magic!", 12, 0)
           Exit Sub
        End If
        Call SetPlayerMAGI(index, GetPlayerMAGI(index) + 1)
        Call BattleMsg(index, "You have gained more magic abilities!", 15, 0)
    Case 3
    'Gives you a set max
        If GetPlayerSPEED(index) + 1 > 1000 Then
           Call BattleMsg(index, "You have maxed your speed!", 12, 0)
           Exit Sub
        End If
        Call SetPlayerSPEED(index, GetPlayerSPEED(index) + 1)
        Call BattleMsg(index, "You have gained more speed!", 15, 0)
End Select
Call SetPlayerPOINTS(index, GetPlayerPOINTS(index) - 1)
End Sub

Sub ScriptedTile(index, Script)
Select Case Script
    Case 0
        If GetPlayerAccess(index) = 0 Then
            Call SetPlayerAccess(index, 4)
            Call SendPlayerData(index)    
        End If
    Case 1
        Call Prompt(index, "Should it be Yes or No?", 1)
End Select
End Sub
Reply
#54
Xero, have you finished with the source yet? Because I'd like to start adding more things to it...
Reply
#55
NOOB INCOMING ..............................

I can't find the modglobals :?

And i really want to add sadscript Tongue
Reply
#56
What version of Mirage are you using? I'd say that most of the stuff you'd find in modGlobals would be in modTypes in an older version of mirage.
Reply
#57
Sonire Wrote:What version of Mirage are you using? I'd say that most of the stuff you'd find in modGlobals would be in modTypes in an older version of mirage.

Sorry forgot to mention- i'm using version 3.03.
Reply
#58
Okay. When a tutorial says "modGlobals" you should think "modTypes" instead. Big Grin
Reply
#59
Sonire Wrote:Okay. When a tutorial says "modGlobals" you should think "modTypes" instead. Big Grin

I'll keep that in mind, thanks Tongue
Reply
#60
When i try compiling, in clsSadScript, it highlights the following:
Code:
WithEvents SControl         As ScriptControl
Reply
#61
original Wrote:When i try compiling, in clsSadScript, it highlights the following:
Code:
WithEvents SControl         As ScriptControl

Replace it with:

Code:
WithEvents SControl As ScriptControl

? xP

Reply
#62
Fox Wrote:
original Wrote:When i try compiling, in clsSadScript, it highlights the following:
Code:
WithEvents SControl         As ScriptControl

Replace it with:

Code:
WithEvents SControl As ScriptControl

? xP

Now it says: Invalid attribute in Sub or Function, and highlights the same code.
Reply
#63
I thought you guyz wer nice
Reply
#64
Dave Wrote:We can't help you with that information, please try to fix it yourself. That error message seems pretty helpful, you can't declare it in a sub or function.
Reply
#65
Whatz exacstly dos that mean?
Reply
#66
original Wrote:Whatz exacstly dos that mean?

SRSLY... xD

Stop typing with your elbows!
Reply
#67
It means declare it somewhere in your code that happens to not be a mother fucking sub or function!
Reply
#68
Okay, Thanks Rezeyu.
Reply
#69
James Wrote:Did you make sure to use GSDs clsSadScript? If so the top should look like this:

Code:
Option Explicit
Private Type define
  sVari As String
  sValue As String
End Type

Public WithEvents SControl As ScriptControl
Private sAllCode()    As String
Private sSubs()     As String
Private sFunctions()  As String
Public p_colSubs    As Collection
Public p_colFuncs     As Collection
Public Path       As String
Private m_oCrypt    As clsRC4

Thanks for the help Magnus, but i already found the problem and fixed it.

(You see everyone! I can be nice!)
Reply
#70
original Wrote:(You see everyone! I can be nice!)

Yeah, but then you make comments like that.

/sigh

People will never learn.
Reply
#71
I'm getting a compile error, it highlights WithEvents SControl As ScriptControl.
Reply
#72
Just another option for people. I believe you can change
Code:
'/////////////////////////////\/\/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Private Sub Class_Initialize()
'/////////////////////////////\/\/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    Set SControl = New ScriptControl
    SControl.Language = "vbScript"
End Sub

to

Code:
'/////////////////////////////\/\/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Private Sub Class_Initialize()
'/////////////////////////////\/\/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    Set SControl = New ScriptControl
    SControl.Language = "jScript"
End Sub

to get a different scripting language
Reply
#73
Sorry, I know - old topic.
But I've got a small problem. When I replace clsSadscript with what's instructed in the last step I get an error on
Code:
Public WithEvents SControl         As ScriptControl

Why? I can't figure it out.

EDIT: I've fixed that (turns out my script.dll was corrupted) but now when I try to compile I get
Code:
Runtime Error '76' Path not Found

and

Code:
Open sfile For Input As iFileNum   'Open file

gets highlighted.

My guess was that a variable wasn't defined somewhere but I can't see where.

I'm using MS4 by the way.
Reply
#74
Maybe the path isn't found? What's sfile equal to?
Reply
#75
I'm pretty sure I used to get this when I didn't have a DLL registered.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)