Jump to content

Using the execute function


Recommended Posts

I have a subroutine I have written and when I call it I get this error expected end of statement. Here is the code for the subroutine:

Public Sub CreateLinks(xmlcode)set Hero = new cHeroSet XML = Server.Createobject("MSXML2.DomDocument.6.0")XML.LoadXML(xmlcode)endoflinks=0Dim oNodeDo until endoflinks=1For each oNode in XML.SelectNodes("/City/Links/Link")'Checks for the end of links tag and if it finds it exit the loop.If oNode.text = "END OF LINKS" thenendoflinks=1exit subEnd IfsDestination = oNode.getAttribute("destination")'Checks for the header attributeIf sDestination = "#HEADER#" thenEventRequired = oNode.getAttribute("Event")'Checks for an event requirementIf IsNull(EventRequired) thenresponse.write "<b style='color:white'>" & oNode.text & "</b><br />"ElseEventNumber=CInt(EventRequired)If Hero.HaveEvent(EventNumber) thenresponse.write "<b style='color:white'>" & oNode.text & "</b><br />"Elseresponse.write ""End IfEnd If'Checks for a line break (space)ElseIf sDestination = "#SPACE#" thenresponse.write "<br />"ElseEventRequired = oNode.getAttribute("Event")RequiredIfStatement = oNode.getAttribute("requirement")'Checks for an event requirementIf IsNull(EventRequired) thenresponse.write "<a href=""" & Replace(oNode.getAttribute("destination"),"_","&") & """ class=""link""><img src='" & BaseDirectory("images/icons/" & oNode.getAttribute("icon") & "") & "' style='border: 1px solid gold' />" & oNode.text & "</a><br />"ElseEventNumber=CInt(EventRequired)If Hero.HaveEvent(EventNumber) thenresponse.write "<a href=""" & Replace(oNode.getAttribute("destination"),"_","&") & """ class=""link""><img src='" & BaseDirectory("images/icons/" & oNode.getAttribute("icon") & "") & "' style='border: 1px solid gold' />" & oNode.text & "</a><br />"Elseresponse.write ""End IfEnd If'Checks if an if statement is requiredIf RequiredIfStatement = "NONE" OR IsEmpty(RequiredIfStatement) thenresponse.write ""ElseIfStatementCode = "If " & RequiredIfStatement & " then response.write ""<a href=""" & Replace(oNode.getAttribute("destination"),"_","&") & """ class=""link""><img src='" & BaseDirectory("images/icons/" & oNode.getAttribute("icon") & "") & "' style='border: 1px solid gold' />" & oNode.text & "</a><br />"" Else response.write """" End If"response.write IfStatementCodeExecute(IfStatementCode) 'The error comes from this lineEnd IfEnd IfNextloopEnd sub

The XML Code is this:

<City name="Dragoth" portrait="dragoth.png"><Description>Dragoth is a small town, but well situated for new comers as it has many different facilities for all different professions.</Description><AreaPreCode></AreaPreCode><Links><Link destination="#HEADER#" requirement="NONE">Town Square</Link><Link destination="Content.asp?LocationID=3" icon="market.png" requirement="NONE">Market</Link><Link destination="Content.asp?LocationID=4" icon="inn.png" requirement="NONE">Inn</Link><Link destination="Content.asp?LocationID=5" icon="chest.png" requirement="NONE">Vault</Link><Link destination="Content.asp?LocationID=6" icon="tutorial-icon.png" requirement="Hero.HaveQuestObjective(1,2) = 1">Town Crier</Link><Link destination="Content.asp?LocationID=6" icon="tutorial-icon.png" requirement="Hero.HaveQuestObjective(1,6) = 1 AND Hero.QuestIsComplete(1) = 0">Town Crier</Link><Link destination="#SPACE#"></Link><Link destination="#HEADER#" Event="1">Leave Town</Link><Link destination="Content.asp?LocationID=7_Travel=1" Event="1" icon="gates.png">City Gates (1 Turn)</Link><Link>END OF LINKS</Link></Links></City>

Here is the IfStatementCode variable value after being parsed:

If Hero.HaveQuestObjective(1,2) = 1 then response.write "<a class=""link"" href=""Content.asp?LocationID=6""><img style=""border: 1px solid gold"" src=""http://localhost/DragonCraft/images/icons/tutorial-icon.png"">Town Crier</a><br>" Else response.write "" End If

Edited by Glorfindel
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...