Mirage Source
http://www.miragesource.net/forums/

Adding SadScript Support
http://www.miragesource.net/forums/viewtopic.php?f=210&t=29
Page 2 of 5

Author:  Braydok [ Thu Mar 22, 2007 12:50 am ]
Post subject: 

Um, can someone please help me here? I have no idea what I am doing.

I try to put the execut script statement in my join game sub and try to add a little player message, but it doesn't work at all. :( Any help?

~Braydok

Author:  William [ Thu Mar 22, 2007 8:56 am ]
Post subject: 

You need to add everything from the tutorial.

Author:  Braydok [ Mon Mar 26, 2007 12:30 pm ]
Post subject: 

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. :(

Author:  William [ Mon Mar 26, 2007 1:12 pm ]
Post subject: 

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. :(

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:

Author:  Braydok [ Mon Mar 26, 2007 1:59 pm ]
Post subject: 

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) <= ADMIN_MONITER Then
    '    Call GlobalMsg(GetPlayerName(Index) & " has joined " & GAME_NAME & "!", JoinLeftColor)
    'Else
    '    Call GlobalMsg(GetPlayerName(Index) & " has joined " & GAME_NAME & "!", White)
    'End If
    '
    ' Send an ok to client to start receiving in game data
    Call SendDataTo(Index, "LOGINOK" & SEP_CHAR & Index & SEP_CHAR & END_CHAR)
   
    ' 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))

    ' Send welcome messages

Call SendWelcome(Index)
           
    ' Send the flag so they know they can start doing stuff
        Call SendDBodiesLogin(Index)
    Call SendDataTo(Index, "INGAME" & SEP_CHAR & END_CHAR)
End Sub

Author:  James [ Tue Mar 27, 2007 12:28 pm ]
Post subject: 

Alright, I don't see it anywhere in the code, what exactly do I put in the clsCommands thing?

Author:  Matt [ Tue Mar 27, 2007 1:46 pm ]
Post subject: 

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.

Author:  James [ Tue Mar 27, 2007 2:16 pm ]
Post subject: 

But someone said something about adding SendData to it..so I'm confused.

Author:  Braydok [ Tue Apr 10, 2007 9:45 pm ]
Post subject: 

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?

Author:  Robin [ Tue Apr 10, 2007 10:58 pm ]
Post subject: 

Braydok, why are you trying to add this?

Author:  Braydok [ Wed Apr 11, 2007 11:55 am ]
Post subject: 

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

Author:  Matt [ Wed Apr 11, 2007 1:36 pm ]
Post subject: 

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

Author:  Braydok [ Thu Apr 12, 2007 11:09 am ]
Post subject: 

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. :(

Author:  Robin [ Thu Apr 12, 2007 1:59 pm ]
Post subject: 

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. :(


Don't bother adding it.

You'll just confuse yourself.

Author:  Boo [ Tue Apr 17, 2007 2:58 am ]
Post subject: 

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

Author:  Matt [ Thu Apr 19, 2007 1:46 pm ]
Post subject: 

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.

Author:  GodSentDeath [ Thu Apr 19, 2007 2:54 pm ]
Post subject: 

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.

Author:  Verrigan [ Thu Apr 19, 2007 2:54 pm ]
Post subject: 

Did you add the scriptcontrol reference to your project?

Author:  Matt [ Thu Apr 19, 2007 2:56 pm ]
Post subject: 

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

Thanks Sean and Ver.

Author:  Da Undead [ Fri Apr 20, 2007 2:01 am ]
Post subject: 

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

Author:  Matt [ Sat Apr 21, 2007 2:02 am ]
Post subject: 

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

Author:  Da Undead [ Sat Apr 21, 2007 2:59 am ]
Post subject: 

which file is that >.< :\

Author:  Matt [ Sat Apr 21, 2007 7:07 pm ]
Post subject: 

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

Author:  Da Undead [ Sat Apr 21, 2007 11:48 pm ]
Post subject: 

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

Author:  Braydok [ Fri Apr 27, 2007 12:15 pm ]
Post subject: 

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

Page 2 of 5 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/