Kemerd Posted March 12, 2013 Author Share Posted March 12, 2013 Well, I'm trying to make an Option for semi-transparent trees. I'm using an Option for that, and here's my code. Tells me to add something. Syntax Error.> Public Sub DrawMapResource(ByVal Resource_num As Long, Optional ByVal screenShot As Boolean = False)> > Dim Resource_master As Long> > Dim Resource_state As Long> > Dim Resource_sprite As Long> > Dim rec As RECT> > Dim X As Long, Y As Long> > Dim i As Long, Alpha As Long> > ' If debug mode, handle error then exit out> > If Options.Debug = 1 Then On Error GoTo errorhandler> > If Options.STT = 0 Then> > ' make sure it's not out of map> > If MapResource(Resource_num).X > Map.MaxX Then Exit Sub> > If MapResource(Resource_num).Y > Map.MaxY Then Exit Sub> > ' Get the Resource type> > Resource_master = Map.Tile(MapResource(Resource_num).X, MapResource(Resource_num).Y).data1> > If Resource_master = 0 Then Exit Sub> > If Resource(Resource_master).ResourceImage = 0 Then Exit Sub> > ' Get the Resource state> > Resource_state = MapResource(Resource_num).ResourceState> > If Resource_state = 0 Then ' normal> > Resource_sprite = Resource(Resource_master).ResourceImage> > ElseIf Resource_state = 1 Then ' used> > Resource_sprite = Resource(Resource_master).ExhaustedImage> > End If> > ' cut down everything if we're editing> > If InMapEditor Then> > Resource_sprite = Resource(Resource_master).ExhaustedImage> > End If> > ' src rect> > With rec> > .Top = 0> > .Bottom = Tex_Resource(Resource_sprite).Height> > .Left = 0> > .Right = Tex_Resource(Resource_sprite).Width> > End With> > ' Set base x + y, then the offset due to size> > X = (MapResource(Resource_num).X * PIC_X) - (Tex_Resource(Resource_sprite).Width / 2) + 16> > Y = (MapResource(Resource_num).Y * PIC_Y) - Tex_Resource(Resource_sprite).Height + 32> > Next> > Then if Options.STT = 0> > Then> > ' render it> > If Not screenShot Then> > Call DrawResource(Resource_sprite, X, Y, rec)> > Else> > Call ScreenshotResource(Resource_sprite, X, Y, rec)> > End If> > Else> > ' render it> > Call DrawResource(Resource_sprite, Alpha, X, Y, rec)> > ' Semi Transparent Trees ![:D](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/biggrin.png)> > For i = 1 To Player_HighIndex> > If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then> > If ConvertMapY(GetPlayerY(i)) < ConvertMapY(MapResource(Resource_num).Y) And ConvertMapY(GetPlayerY(i)) > ConvertMapY(MapResource(Resource_num).Y) - (Tex_Resource(Resource_sprite).Height) / 32 Then> > If ConvertMapX(GetPlayerX(i)) >= ConvertMapX(MapResource(Resource_num).X) - ((Tex_Resource(Resource_sprite).Width / 2) / 32) And ConvertMapX(GetPlayerX(i)) <= ConvertMapX(MapResource(Resource_num).X) + ((Tex_Resource(Resource_sprite).Width / 2) / 32) Then> > Alpha = 150> > Else> > Alpha = 255> > End If> > Else> > Alpha = 255> > End If> > End If> > Next> > ' Error handler> > Exit Sub> > errorhandler:> > HandleError "DrawMapResource", "modGraphics", Err.Number, Err.Description, Err.Source, Err.HelpContext> > Err.Clear> > Exit Sub> > End Sub Link to comment Share on other sites More sharing options...
PD Posted March 12, 2013 Share Posted March 12, 2013 Eh…what is this? ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)```Then if Options.STT = 0Then```It should be:```If Options.STT = 0 Then``` Link to comment Share on other sites More sharing options...
Lavos Posted March 12, 2013 Share Posted March 12, 2013 Ugh reading it in this format gives me a headache, overall this code is a big mess!```Public Sub DrawMapResource(ByVal Resource_num As Long, _ Optional ByVal screenShot As Boolean = False) Dim Resource_master As Long Dim Resource_state As Long Dim Resource_sprite As Long Dim rec As RECT Dim X As Long, Y As Long Dim i As Long, Alpha As Long ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler If Options.STT = 0 Then ' make sure it's not out of map If MapResource(Resource_num).X > Map.MaxX Then Exit Sub If MapResource(Resource_num).Y > Map.MaxY Then Exit Sub ' Get the Resource type Resource_master = Map.Tile(MapResource(Resource_num).X, MapResource(Resource_num).Y).Data1 If Resource_master = 0 Then Exit Sub If Resource(Resource_master).ResourceImage = 0 Then Exit Sub ' Get the Resource state Resource_state = MapResource(Resource_num).ResourceState If Resource_state = 0 Then ' normal Resource_sprite = Resource(Resource_master).ResourceImage ElseIf Resource_state = 1 Then ' used Resource_sprite = Resource(Resource_master).ExhaustedImage End If ' cut down everything if we're editing If InMapEditor Then Resource_sprite = Resource(Resource_master).ExhaustedImage End If ' src rect With rec .Top = 0 .Bottom = Tex_Resource(Resource_sprite).Height .Left = 0 .Right = Tex_Resource(Resource_sprite).Width End With ' Set base x + y, then the offset due to size X = (MapResource(Resource_num).X * PIC_X) - (Tex_Resource(Resource_sprite).Width / 2) + 16 Y = (MapResource(Resource_num).Y * PIC_Y) - Tex_Resource(Resource_sprite).Height + 32 ' render it If Not screenShot Then Call DrawResource(Resource_sprite, X, Y, rec) Else Call ScreenshotResource(Resource_sprite, X, Y, rec) End If Else If Options.STT = 1 Then ' render it Call DrawResource(Resource_sprite, Alpha, X, Y, rec) ' Semi Transparent Trees ![:D](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/biggrin.png) For i = 1 To Player_HighIndex If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then If ConvertMapY(GetPlayerY(i)) < ConvertMapY(MapResource(Resource_num).Y) And ConvertMapY(GetPlayerY(i)) > ConvertMapY(MapResource(Resource_num).Y) - (Tex_Resource(Resource_sprite).Height) / 32 Then If ConvertMapX(GetPlayerX(i)) >= ConvertMapX(MapResource(Resource_num).X) - ((Tex_Resource(Resource_sprite).Width / 2) / 32) And ConvertMapX(GetPlayerX(i)) <= ConvertMapX(MapResource(Resource_num).X) + ((Tex_Resource(Resource_sprite).Width / 2) / 32) Then Alpha = 150 Else Alpha = 255 End If End If End If Next End If End Iferrorhandler: HandleError "DrawMapResource", "modGraphics", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub```See if this would help….Edit: I clean up the code a bit. Link to comment Share on other sites More sharing options...
Kemerd Posted March 13, 2013 Author Share Posted March 13, 2013 Now it's telling me:Byref argument type mismatch.with the Line.Call DrawResource(Resource_sprite, Alpha, X, Y, rec)Is it already declared?I'm using EO 3.0, with this tut: [http://www.touchofdeathforums.com/community/index.php?/topic/131189-semi-transparent-trees/](http://www.touchofdeathforums.com/community/index.php?/topic/131189-semi-transparent-trees/) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now