Mirage Source
Adding SadScript Support - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49)
+---- Thread: Adding SadScript Support (/showthread.php?tid=21)

Pages: 1 2 3


- Braydok - 27-04-2007

Really? Oops, sorry about that.
Yes, as Advocate said, I am making a game engine.


- Da Undead - 29-04-2007

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)


- Da Undead - 29-04-2007

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



- Braydok - 02-05-2007

Xero, have you finished with the source yet? Because I'd like to start adding more things to it...


Re: Adding SadScript Support - jiros - 31-12-2007

NOOB INCOMING ..............................

I can't find the modglobals :?

And i really want to add sadscript Tongue


Re: Adding SadScript Support - Rian - 31-12-2007

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.


Re: Adding SadScript Support - jiros - 01-01-2008

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.


Re: Adding SadScript Support - Rian - 02-01-2008

Okay. When a tutorial says "modGlobals" you should think "modTypes" instead. Big Grin


Re: Adding SadScript Support - jiros - 02-01-2008

Sonire Wrote:Okay. When a tutorial says "modGlobals" you should think "modTypes" instead. Big Grin

I'll keep that in mind, thanks Tongue


Re: Adding SadScript Support - original - 18-03-2008

When i try compiling, in clsSadScript, it highlights the following:
Code:
WithEvents SControl         As ScriptControl



Re: Adding SadScript Support - Coke - 19-03-2008

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




Re: Adding SadScript Support - original - 19-03-2008

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.


Re: Adding SadScript Support - original - 19-03-2008

I thought you guyz wer nice


Re: Adding SadScript Support - Coke - 19-03-2008

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.



Re: Adding SadScript Support - original - 19-03-2008

Whatz exacstly dos that mean?


Re: Adding SadScript Support - Coke - 19-03-2008

original Wrote:Whatz exacstly dos that mean?

SRSLY... xD

Stop typing with your elbows!


Re: Adding SadScript Support - Rezeyu - 20-03-2008

It means declare it somewhere in your code that happens to not be a mother fucking sub or function!


Re: Adding SadScript Support - original - 20-03-2008

Okay, Thanks Rezeyu.


Re: Adding SadScript Support - original - 21-03-2008

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!)


Re: Adding SadScript Support - Matt - 21-03-2008

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

Yeah, but then you make comments like that.

/sigh

People will never learn.


Re: Adding SadScript Support - Joachim - 27-03-2008

I'm getting a compile error, it highlights WithEvents SControl As ScriptControl.


Re: Adding SadScript Support - Labmonkey - 24-04-2008

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


Re: Adding SadScript Support - model51924 - 03-04-2009

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.


Re: Adding SadScript Support - GIAKEN - 05-04-2009

Maybe the path isn't found? What's sfile equal to?


Re: Adding SadScript Support - Nean - 05-04-2009

I'm pretty sure I used to get this when I didn't have a DLL registered.