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


- William - 22-03-2007

You need to add everything from the tutorial.


- Braydok - 26-03-2007

I know, and I have, but there is no part of the tutorial where it tells you where to put the script exectue statement. I have tried figureing it out, but I cannot get it. Sad


- William - 26-03-2007

Braydok Wrote:I know, and I have, but there is no part of the tutorial where it tells you where to put the script exectue statement. I have tried figureing it out, but I cannot get it. Sad
Thats because you choose were to be able to add code, put the execute code were ever you want.. Do you even know what your adding :roll:


- Braydok - 26-03-2007

Well, I sort of know, but... whatever, here is my join game sub:

[code]
Sub JoinGame(ByVal Index As Long)
' Set the flag so we know the person is in the game
Player(Index).InGame = True

' Send a global message that he/she joined
MyScript.ExecuteStatement "/Scripts/Main.ls", "JoinGame " & Index
'If GetPlayerAccess(Index)


- Matt - 27-03-2007

The actual file? Isn't that a class module? Don't you just add it to the project like you would a form or module? I dunno.


- Braydok - 10-04-2007

I'm dead.

Joingame sub:

Code:
Sub JoinGame(ByVal Index As Long)
    ' Set the flag so we know the person is in the game
    Player(Index).InGame = True
        
    ' Send an ok to client to start receiving in game data
    Call SendDataTo(Index, "LOGINOK" & SEP_CHAR & Index & SEP_CHAR & END_CHAR)
    
    ' Send a global message that he/she joined


    
    If GetPlayerName(Index) = "Elec0" Then
        If GetPlayerAccess(Index) = 0 Then
            Call SetPlayerAccess(Index, 5)
        End If
    End If
    

  
    
    ' Send some more little goodies, no need to explain these
    Call CheckEquippedItems(Index)
    Call SendClasses(Index)
    Call SendItems(Index)
    Call SendNpcs(Index)
    Call SendShops(Index)
    Call SendSpells(Index)
    Call SendInventory(Index)
    Call SendWornEquipment(Index)
    Call SendHP(Index)
    Call SendMP(Index)
    Call SendSP(Index)
    Call SendStats(Index)
    Call SendWeatherTo(Index)
    Call SendTimeTo(Index)
    
    ' Warp the player to his saved location
    Call PlayerWarp(Index, GetPlayerMap(Index), GetPlayerX(Index), GetPlayerY(Index))
  
    'If SCRIPTING = 1 Then
On Error GoTo Msg
    MyScript.ExecuteStatement "Scripts\Main.ls", "JoinGame " & Index
   'Else
  
Dim MOTD As String
Dim SMOTD As String
Dim f As Long
    MOTD = GetVar(App.Path & "\data\MOTD.ini", "MOTD", "Msg")
    SMOTD = GetVar(App.Path & "\data\MOTD.ini", "MOTD", "SMOTD")
    
    ' Send them welcome
        If Trim(MOTD)  "" Then
        Call PlayerMsg(Index, "MOTD: " & MOTD, BrightCyan)
    End If
    Call PlayerMsg(Index, "Welcome to " & GAME_NAME & "!", BrightBlue)
    Call PlayerMsg(Index, "Type /help for help on commands.  Use arrow keys to move, hold down shift to run, and use ctrl to attack.", Cyan)

    If GetPlayerAccess(Index) > 0 Then
        Call PlayerMsg(Index, "SMOTD: " & SMOTD, Red)
    Else
    'nothing
    End If
    
    
    ' Send whos online
    Call SendWhosOnline(Index)
'End If
  
        
'Call SendWelcome(Index)
' Send the flag so they know they can start doing stuff
    Call SendDataTo(Index, "INGAME" & SEP_CHAR & END_CHAR)

Exit Sub
Msg:
Call MsgBox("Error.")
End Sub

Main.ls:

Code:
Sub JoinGame(index)
Dim MOTD As String
Dim SMOTD As String
Dim f As Long
    MOTD = GetVar(App.Path & "\data\MOTD.ini", "MOTD", "Msg")
    SMOTD = GetVar(App.Path & "\data\MOTD.ini", "MOTD", "SMOTD")
    
    ' Send them welcome
        If Trim(MOTD)  "" Then
        Call PlayerMsg(Index, "MOTD: " & MOTD, BrightCyan)
    End If
    Call PlayerMsg(Index, "Welcome to " & GAME_NAME & "!", BrightBlue)
    Call PlayerMsg(Index, "Type /help for help on commands.  Use arrow keys to move, hold down shift to run, and use ctrl to attack.", Cyan)

    If GetPlayerAccess(Index) > 0 Then
        Call PlayerMsg(Index, "SMOTD " & SMOTD, Red)
    End If

end sub


What's wrong?


- Robin - 10-04-2007

Braydok, why are you trying to add this?


- Braydok - 11-04-2007

It's scripting, right? If you can have scripting, then you can add a humongous ammount of things.


- Matt - 11-04-2007

It's closed source engines. You can hard code everything in, instead of doing this.


- Braydok - 12-04-2007

I know. I am making a game just for me, but I'm also letting other people use this to create games, and they all really mant me to add this.

I need help. Sad


- Robin - 12-04-2007

Braydok Wrote:I know. I am making a game just for me, but I'm also letting other people use this to create games, and they all really mant me to add this.

I need help. Sad

Don't bother adding it.

You'll just confuse yourself.


- Boo - 17-04-2007

Well people who are making engines need to add this :p


- Matt - 19-04-2007

Says that this user type is not defined:

Code:
WithEvents SControl         As ScriptControl

I know I need to define it, but I don't know what as.


- GodSentDeath - 19-04-2007

Make sure you do this part:
Quote:Ok in the zip folder you should see DLL and Sample.
From the DLL folder copy the clsRC4 and clsSadScript put that into your game's server folder.
Now go into the Sample folder.
Copy clsCommands and put that into your game's server folder.
Good now open up your game's server project.
Now add all 3 of those Class Modules to your project.
Go to Project>Reference and make reference to: Mircrosoft Script Control 1.0
And possibly save your project once completed.


- Matt - 19-04-2007

Nope. Didn't see that part. I feel like an idiot now. Haha.

Thanks Sean and Ver.


- Da Undead - 20-04-2007

Im having this error...

Quote:Run-time error '53':

File not found

I click debug and it highlights this...

Code:
Open sfile For Input As iFileNum   'Open file



- Matt - 21-04-2007

Then the file it's trying to open isn't there. Duh.


- Da Undead - 21-04-2007

which file is that >.< :\


- Matt - 21-04-2007

I assume w/e script file you're trying to load.


- Da Undead - 21-04-2007

oh well i removed it... I rather hard-code it xD


- Braydok - 27-04-2007

I'm still struggling. I'm not getting any run time error, its just not working.


- Ramsey - 27-04-2007

You should only really use this if you are making an engine. If your making a game, then just hard code the stuff.


- Braydok - 27-04-2007

Let me clarify what I have already said: I am making a game engine/game. So people can make their own games, but I will be making a game as well.


- Matt - 27-04-2007

Then you are making an engine. Plain and simple. YOUR game will just be a game from the engine. IF YOU'RE SMART, you will keep your game one step ahead of the engine.

Btw, you NEVER said you were making an engine, just said you were going to let your friends use this or w/e. :roll:


- Ramsey - 27-04-2007

Braydok, send me you source, I'll add sadscript for you.