Thread: Readding eval()
View Single Post
  #26  
Old 03-22-2007, 10:54 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Skyld View Post
Seems like insecure design to rely on eval()-like functionality to do that. :|
Maybe, it was a passing thought. Don't see how its much different that placing something in scripts folder.
Quests will work much better as their own object that manipulates the mudlib rather than a part of it.

My current use for eval() would be in my Dialog System, when a response to a topic is evaluated from the conditions of the response, a number of functions are allowed to be executed. For now it is only able to execute one function per script line.
PHP Code:
resp0.scriptcount=2
resp0
.script0=AddItem,50,gold
resp0
.script1=AddMsg,6,"You received 50 Gold coins." 
The functions AddItem and AddMsg are defined in the DialogControl as pfnAddItem() and pfnAddMsg(), the pfn meaning Parseable Function. And I have to translate all these functions to interact with the systems on Aeon, or whatever server will use the system.

Also there are the condition statements, which I would have loved if they could be evaluated, but since they're not I had to design the conditions object to load them into a format to be evaluated.

PHP Code:
resp0.conditionscount=1
resp0
.cond0=function,HasReadTopic,"arkland,",<,value,1,0,
Meaning: resp#.cond#=atype,avalue,aparams,comparator,btype, bvalue,bparams,or

If a condition could be evaluated from a script form using a function it would be alot easier to perform.
But as it is now, each part of the condition array is loaded into the condition object, and when the time comes to get the correct topic response for a player, eval() is called on the condition by the response object and this is calculated.
__________________

Last edited by Inverness; 03-22-2007 at 11:13 PM..
Reply With Quote