• Welcome to Valhalla Legends Archive.
 

Code from .txt ?

Started by WiLD, June 16, 2006, 07:13 AM

Previous topic - Next topic

WiLD

Just a stupid question but is it possible to pull code from a txt file and execute it as if it were hardcoded? ..or anything similar?


Im guessing i could always use vbscript and call the function but i want to try and steer away from that.

Eg; code.txt

insertdword ...
insertdword ...
insertdword ...
sendpacket  ...
bsend "done"


and i can just 'insert' that wherever.
=_=  &&  g0dFraY  &&  -=Templar=-  @USWest

rabbit

Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

warz

I think the CallByName function is as close as you will get to dynamically calling functions during run-time.

Yegg

Most languages should be able to do this. This is one thing I love about LISP, such a task would be solved with little to no effort. I remember Python having an eval() function that may perform the same or similar task.

To make sure I understand you correctly, if you had "1 + 1" copied down somewhere in a text document, would you want to evaluate the "code" from that document to get the result of 2?

warz

Looks to me like he's wanting to be able to place his packet structures in text files so he can add support for new packets 'on the fly'.

vuther.de

Wouldn't be a bad idea.

MyndFyre

Why do you want to steer away from VBScript?  The Windows Script Host provides access to VBScript, JScript, and any other ActiveX-supported scripting language developed for Windows, including ActivePerl and ActivePython, among others.

It seems like one of the easiest and most flexible ways to do this.  Otherwise you'd need to pretty much implement your own parser, or use someone else's scripting engine.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

WiLD

Quote from: Yegg on June 16, 2006, 09:40 AM
Most languages should be able to do this. This is one thing I love about LISP, such a task would be solved with little to no effort. I remember Python having an eval() function that may perform the same or similar task.

To make sure I understand you correctly, if you had "1 + 1" copied down somewhere in a text document, would you want to evaluate the "code" from that document to get the result of 2?

Correct.


Quote from: warz on June 16, 2006, 09:58 AM
Looks to me like he's wanting to be able to place his packet structures in text files so he can add support for new packets 'on the fly'.

I was thinking about doing this, if i decided to i would proberly stick with vbscript since it would be easier.
At the moment i only want users to be able to 'inject' their own code that will be executed at an event.
=_=  &&  g0dFraY  &&  -=Templar=-  @USWest

Spilled

very interesting. This is something I have never tried and I'll look into this. :)

warz

Quote from: WiLD on June 16, 2006, 01:27 PM
Quote from: Yegg on June 16, 2006, 09:40 AM
Most languages should be able to do this. This is one thing I love about LISP, such a task would be solved with little to no effort. I remember Python having an eval() function that may perform the same or similar task.

To make sure I understand you correctly, if you had "1 + 1" copied down somewhere in a text document, would you want to evaluate the "code" from that document to get the result of 2?

Correct.


Quote from: warz on June 16, 2006, 09:58 AM
Looks to me like he's wanting to be able to place his packet structures in text files so he can add support for new packets 'on the fly'.

I was thinking about doing this, if i decided to i would proberly stick with vbscript since it would be easier.
At the moment i only want users to be able to 'inject' their own code that will be executed at an event.

Make way for bugs. :-p

vuther.de

Quote from: warz on June 16, 2006, 08:51 PM
Quote from: WiLD on June 16, 2006, 01:27 PM
Quote from: Yegg on June 16, 2006, 09:40 AM
Most languages should be able to do this. This is one thing I love about LISP, such a task would be solved with little to no effort. I remember Python having an eval() function that may perform the same or similar task.

To make sure I understand you correctly, if you had "1 + 1" copied down somewhere in a text document, would you want to evaluate the "code" from that document to get the result of 2?

Correct.


Quote from: warz on June 16, 2006, 09:58 AM
Looks to me like he's wanting to be able to place his packet structures in text files so he can add support for new packets 'on the fly'.

I was thinking about doing this, if i decided to i would proberly stick with vbscript since it would be easier.
At the moment i only want users to be able to 'inject' their own code that will be executed at an event.

Make way for bugs. :-p

Especially for inexperienced people that attempt to do a code, and it mess their bot up and them not know how to fix it.

topaz

Quote from: inner.de on June 16, 2006, 11:23 PM
Quote from: warz on June 16, 2006, 08:51 PM
Quote from: WiLD on June 16, 2006, 01:27 PM
Quote from: Yegg on June 16, 2006, 09:40 AM
Most languages should be able to do this. This is one thing I love about LISP, such a task would be solved with little to no effort. I remember Python having an eval() function that may perform the same or similar task.

To make sure I understand you correctly, if you had "1 + 1" copied down somewhere in a text document, would you want to evaluate the "code" from that document to get the result of 2?

Correct.


Quote from: warz on June 16, 2006, 09:58 AM
Looks to me like he's wanting to be able to place his packet structures in text files so he can add support for new packets 'on the fly'.

I was thinking about doing this, if i decided to i would proberly stick with vbscript since it would be easier.
At the moment i only want users to be able to 'inject' their own code that will be executed at an event.

Make way for bugs. :-p

Especially for inexperienced people that attempt to do a code, and it mess their bot up and them not know how to fix it.

Oh, man...
RLY...?

Warrior

Quote from: inner.de on June 16, 2006, 11:23 PM
Quote from: warz on June 16, 2006, 08:51 PM
Quote from: WiLD on June 16, 2006, 01:27 PM
Quote from: Yegg on June 16, 2006, 09:40 AM
Most languages should be able to do this. This is one thing I love about LISP, such a task would be solved with little to no effort. I remember Python having an eval() function that may perform the same or similar task.

To make sure I understand you correctly, if you had "1 + 1" copied down somewhere in a text document, would you want to evaluate the "code" from that document to get the result of 2?

Correct.


Quote from: warz on June 16, 2006, 09:58 AM
Looks to me like he's wanting to be able to place his packet structures in text files so he can add support for new packets 'on the fly'.

I was thinking about doing this, if i decided to i would proberly stick with vbscript since it would be easier.
At the moment i only want users to be able to 'inject' their own code that will be executed at an event.

Make way for bugs. :-p

Especially for inexperienced people that attempt to do a code, and it mess their bot up and them not know how to fix it.

Haha
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

Newby

I think you're better off releasing the source.
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

WiLD

Quote from: Newby on June 17, 2006, 01:14 PM
I think you're better off releasing the source.

I plan to at a later stage, as with all my projects i normally release source around v2 (If it get sthat far).

Anyways i have been looking around and i ended up looking on pscode.com, after awhile i found this (click here) which proves to be interesting but im having a little problem.
In the sample project im getting "Application or object defined error" on

Set MyScript = New clsSadScript

Anyone able to figure out why?  :-X


P.S. Remember to register and make a reference to the dll.

Thanks  ;)
=_=  &&  g0dFraY  &&  -=Templar=-  @USWest