Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Pwn'est One Liner


Guest
 Share

Recommended Posts

Code your pwn'est one line C/C++/VB/SadScipt or w/e code. It must be functional and all on one line (except preprocessor directives ofc).

Ill start off small:
```
#include int a=2;int b=2;int add(int a,int b){int c=a+b;}int main(){printf("%i+%i=%i",a,b,add(a,b));return 0;}
```
Link to comment
Share on other sites

OnNpcDeath:
```
  Call SpawnItemOnMap(GetPlayerMap(Index), GetNpcX(Map, NPCIndex), GetNpcY(Map, NPCIndex), Int(GetVar("NpcInfo.ini", "" & NPCNum & "", "ItemNum")), Rand(Int(GetVar("NpcInfo.ini", "" & NPCNum & "", "Low")), Int(GetVar("NpcInfo.ini", "" & NPCNum & "", "High"))), 0)

```If you set the inis up correctly, the NPCs can drop a random amount of gold on the map when you kill them.
Link to comment
Share on other sites

```
int main () {int answer; cout << "Desperate for Eclipse++, are you?" << end1; cin << answer;
cout << "OMG i can't belive you just said " answer "!";
```I'm guessing that there are many errors, only had about 10 mins of tutorials.
Link to comment
Share on other sites

```
int main(){int answer;cout << "Desperate for Eclipse++, are you?\n";cin >> answer;cout << "OMG i can't belive you just said " << answer << "!\n";return 0;}
```
Fixed I think ;P
Link to comment
Share on other sites

Thing is with c/c++, most of the time you can have a functional program without any linebreaks.

Do something in vbscript or basic-sytnax, then we'll talk.

Here's a modified version of that other guy's script, since he was asking for an int (which means it needs to be a number)
```
int getInt(string prompt); int main() { int answer; try answer = getInt("Desperate for Eclipse++, are you?\n"); catch(runtime_error e) { cout << e.what() << endl; cout << "I take it you want it no? Type a number next time" << endl; age = 0; }  cout << ""OMG i can't belive you just said " << answer << endl; return 0; } int getInt(string prompt) { int integer; cout << prompt; if (!(cin >> integer)) { runtime_error e("Non-integer data"); throw e; } return integer; }
```
Link to comment
Share on other sites

You can program anything with no line breaks, the language doesn't matter because when you compile it gets mashed all into one line then binary anyway lol.
Link to comment
Share on other sites

@Desiderium:

> If you use an interpreter it slows down the compiling though, yeah?

A compiler interprets the code. They both go through the same process until a certain point, where the interpreter just emulates it.

[Implenting a scripting engine](http://www.flipcode.com/archives/Implementing_A_Scripting_Engine-Part_1_Overview.shtml) explains the process more descriptively although it uses 3rd-party tools.

Regards,
  Godlord.
Link to comment
Share on other sites

@Krankzinnig:

> You can program anything with no line breaks, the language doesn't matter because when you compile it gets mashed all into one line then binary anyway lol.

But won't basic-syntax mess up?

```
Sub MyHappySub(Index, Value)
  If Value = 3 Then
      Call PlayerMsg(Index, "The value is three!", RED)
  Else
      Call PlayerMsg(Index, "Sorry, no value!", RED)
  End If
End Sub
```Would work, but would this:
```
Sub MyHappySub(Index, Value) If Value = 3 Then Call PlayerMsg(Index, "The value is three!", RED) Else Call PlayerMsg(Index, "Sorry, no value!", RED) End If End Sub
```
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...