On Modding and Mods

Jan 10, 2013 at 8:32 AM
Not anymore
"Run, rabbit run. Dig that hole, forget the sun."
Join Date: Jan 28, 2010
Location: Internet
Posts: 1369
Age: 34
Pronouns: he/him

Why is Cave Story modding hard?



This is a rant about why modding the original version of PC Cave Story
is so difficult and why making an EXACT clone of Cave Story in C++
will not help very much.



For a Cave Story clone to be successful, it must be significantly different
from the original in some particular way, or else we are just playing the same old
unmoddable game on the same old PC, or some other platform.

Why do some people consider modding to be a difficult chore?


Because every modder is lazy? Because people like to procrastinate?
Because people prefer working on projects that make more sense as
well as cents? (mucho dinero)



No, that is not true. Most modders are not lazy, and many people don't procrastinate that much,
at least not while working on something they are genuinely interested in. Even though someone might
work on something else for a while, that just makes said person a better talent overall, right?



Sure. But why have only a few people finished a mod?



Completely finished mods, as in ones that possess credits that do not display
"Thanks for trying demo 0.38" at the end, tend to have 3 things:
- Different Maps
- Different TSC
- Different Graphics (maybe)

And that's it.



A mod is difficult to make, and it is almost impossible to finish a mod that contains
any assembly hacks at all. A CS clone written in C++ is also nearly impossible to finish,
UNLESS the clone is exactly the same as the original (NXEngine).


NXEngine for PC is a bit pointless, at least in my opinion, because we already have the
original and can edit the x86 assembly contents of the original game very easily.

When I say "very easily", I mean the laws of physics permit us to do it.



Noxid's CsEngine is not pointless because it does not implement Cave Story. Instead it implements
some version of King: Strife & Sacrifice, colloquially called King's Story by quite a few people
who don't know the real name of the mod/clone/thingy, and also by Noxid who sometimes forgets
that he actually named it K: S&S.



A clone of Cave Story that would support online interaction, such as a possibly revived AGL or
a working version of NetStory, would be far more useful than PC-based NXEngine.

But WHY HAS NOBODY modded NXEngine? At all? Why has nobody made a PC mod of Cave Story using
the C++ code of NXEngine?



Because C++ is much, much more difficult to understand and write than x86 Assembly.
Assembly uses prefix notation, similar to Lisp (a beautiful functional language),
except that it absolutely cannot evaluate nested prefix expressions. Also it has trouble
doing dynamic typing like Lisp, except with those good old void* pointers, which are
the only real pointers in x86 Assembly because bytes are always just bytes.

C++ has horrific syntax, illogical (and unreadable!) use of * and & for multiplication,
dereferencing, bitwise ANDing, referencing, declaring a pointer, and declaring an array
which is also a pointer. Who really thought it was a good idea to use a single operator for
3 or more unrelated purposes?


I would like to congratulate the designers of C and C++ for
creating a language that a computer can successfully parse
and compile into an executable, and yet somehow a human cannot
do the same thing and turn the program into brainwaves
without years of programming experience.


C++ also contains a bunch of other failed attempts at turning C,
a type of assembly language, into JavaScript, a type of object-oriented language.
It is also irrelevant that JavaScript was born after C and C++.
The reason Lisp is beautiful is because it is Lisp. It's recursive.
The reason JavaScript is beautiful is because it is also Lisp, but disguised very thinly.
The reason C++ is beautiful is because it's not beautiful at all. Just like PHP.



C is the language that everyone knows. Java is C-like. Even Python is supposedly C-like.
Even my own language, that I wrote in a C-like language (Java), is C-like.



However, if Lisp was the language of choice, modding would be very very easy.
All we would have to do is open up the executable, which would be a text file just
like a Python script, throw in the magic of meta-circular evaluation, and bam.
Our own NPCs. Our own stuff. Own own custom special effects. Our own 'impossibles' like
getting partial transparency to work correctly in the Cave Story engine.



A lot of people try to decompile assembly into either C or C++.
This is approximately as fruitful as taking asphalt out of a parking lot,
heating it up in some kind of high temperature furnace, and drinking it.



Now, believe it or not, I have not started my argument yet.
All the above words you just read were just chunks of a pointless rambling session,
in which I complain about (actually really useful things) like NXEngine without
citing my sources.



But now, using some real-world modding experience, I will explain why modding
is difficult for me in particular:



1. I cannot draw art very well.
2. I cannot compose music, and when I attempt to copy it, I either do things wrong,
or I get really lazy and only transcript a portion of it.
3. I get bored very easily.
4. I cannot properly use a scripting language that does not have integers, floats,
and string manipulation.
5. I cannot easily read a programming language that has no indentation blocks.
6. I cannot be bothered to write a plugin for OllyDbg. Instead I must invent
my own Java program that does the opposite of what OllyDbg does:
write x86-32 properly and read it never, instead of read x86-32 properly
and write it horribly.
7. I cannot make maps that are both non-linear and not confusing
at the same time. Either I must make them very linear (Witching Hour)
or completely non-linear (A Lost Land first half). The first possibility
gets people to say that your mod is boring. The second possibility
gets some people to say that your mod is a giant fetch quest when the
actual point of putting unlockables in unusual places was to make the
entire mod less of a (y = constant * x + other_constant).replace("equation", "game").
8. There is no satisfaction after releasing a demo
except for a few people on the Internet saying either "oh cool nice job"
or "wow you suck at music... learn to compose loser..."
And yes, the second one brings me more satisfaction than the first.
It shows that the person ACTUALLY played your mod and is therefore
one of the decent people, instead of being a "cool story bro" guy who
is just a complete jerkass who didn't even get past the first two
rooms and somehow decides that things are probably just 'good enough'.



Number eight is what kills people the most. If nobody cares about your mod,
or nobody decides to criticize it, then what is the point of making a mod?
For fun? Write a standalone game. That'd be much more fun.
The point of modding is not to have fun, which seems a little ridiculous since
the only reason you should actually mod is just for hot wings and giggles.



The point of making a cool mod with a great idea and great dialogue, such
as the Schism Demo 1.0 (Schemo) by Xaser, is to lift yourself to divine levels.
To lift yourself to the level of Studio Pixel.



That is why people mod. To be cool like Mister Daisuke Amaya.
Ultimately, we all love the man, and he made a really good indie game.
But there has to be a better way.



I will do the following.

1. Figure out how to make pretty pictures without actually understanding art.
2. Figure out how to compose like ZUN without becoming his housewife.
3. Figure out how it is possible that Pixel didn't actually study music theory for reals.
4. Improve TSC far beyond the <VAR hack.
5. Write a Python to x86 compiler and patcher. Or something similar.
6. Design all my Aperture Science testing chambers... I mean Cave Story maps, as if I were GLaDOS.
7. Become a rich billionaire so it doesn't matter what the people of the Internet
think of my mod.



And that's basically it.
If you want to help, then don't. Yeah, you read that correctly.


A lot of people beg for help on their projects. I respect that.
It shows you are a team player.



Yesterday I decided to use a code counter on my entire codebase.
It does not count duplicated files, copied repositories, and SVN leftovers.



After writing about 700,000 lines of Java, 250,000 lines of Python,
75,000 lines of C++, and countless lines of nonsense during my life,
I have finally realized that I work best by myself.



Those lines of code include comments. And I don't bother to document
my methods ever, so there probably aren't that many comments.

I know I am perfectly capable of turning TSC into JIT-compiled JavaScript.
I know I can write a Python to x86 compiler/patcher just for Doukutsu.exe.
It's easy. I've already made a compiler for ASM code, and an interpreter for
a Pythonic language. I just need to add some colons, make sure there are no
tabs lying around, connect the two using the purity of the JVM, and I am done.

A better TSC? Easy. I'll just remove the entire parser. And rewrite it
from scratch in Python or x86.



Do you think I am going to keep events? Flags? 4-digit integers?
The < marker? <YNJ instead of custom menus? The same Profile.dat format?
I laugh at such things. The next time you see Doukutsu.exe, it will be
Doukutsu.msi and then Doukutsu.iso, because it will be transformed from
from PC game to web browser to full blown operating system.

If you actually do want to help, just attempt working on your own better
version of Doukutsu.exe first. If you show it to me, maybe we can strike
up and agreement and actually do something useful with our lives, such
as purchase a beach house and rent it out to people.



-- Addendum:
Now, why am I modding an executable? And not compiling source? Because...

1. I hate C/C++ and their impossible to use 3rd party libraries.
2. Java Swing is not the best for games.
3. Python cannot make games. At all. PyGame cannot create useful games.
Katawa Shoujo is like the only reasonable exception, and it uses Ren'Py,
which is not equal-equal to PyGame.



So thus, x86 has the best graphics library: I can write to the graph buffer
and edit the pixels on your monitor. I don't think anything else is actually
capable of doing that directly.
 
Jan 10, 2013 at 1:11 PM
Junior Member
"Fresh from the Bakery"
Join Date: Jan 4, 2013
Location: Singapore
Posts: 13
Age: 31
Pronouns: he/him
I have to say I really love the perspective you have (and give) on a lot of things, though when you start trying to relate things to other programming languages it gets a tad confusing... but whatever, I guess? :confused:

And to prevent this from becoming a post like "oh cool nice job" I think I will add on a little more. :cool:

1. I cannot draw art very well.
2. I cannot compose music, and when I attempt to copy it, I either do things wrong,
or I get really lazy and only transcript a portion of it.
3. I get bored very easily.
4. I cannot properly use a scripting language that does not have integers, floats,
and string manipulation.
5. I cannot easily read a programming language that has no indentation blocks.
6. I cannot be bothered to write a plugin for OllyDbg. Instead I must invent
my own Java program that does the opposite of what OllyDbg does:
write x86-32 properly and read it never, instead of read x86-32 properly
and write it horribly.
7. I cannot make maps that are both non-linear and not confusing
at the same time. Either I must make them very linear (Witching Hour)
or completely non-linear (A Lost Land first half). The first possibility
gets people to say that your mod is boring. The second possibility
gets some people to say that your mod is a giant fetch quest when the
actual point of putting unlockables in unusual places was to make the
entire mod less of a (y = constant * x + other_constant).replace("equation", "game").
8. There is no satisfaction after releasing a demo
except for a few people on the Internet saying either "oh cool nice job"
or "wow you suck at music... learn to compose loser..."
And yes, the second one brings me more satisfaction than the first.
It shows that the person ACTUALLY played your mod and is therefore
one of the decent people, instead of being a "cool story bro" guy who
is just a complete jerkass who didn't even get past the first two
rooms and somehow decides that things are probably just 'good enough'.

I have just about all of the same issues as you here, except for 4 and 6. I can't write code all too well myself, haha. (I know you have written "answers" to your problems as well, but I thought I should write my own "answers" as well since I can relate to quite a number of your points.)

  1. I can't draw very well either. In pixels, I mean. When it comes to paper, it's easier to get your character and details out because you're working with a bigger workspace which allows for more inclusion of details. When you're trying to scale it down into a 16x16 pixel frame it can get a little frustrating trying to consider what elements should be kept, and what elements should be removed in the name of simplification. I rambled on a little too much, but basically try to draw it out on paper (or whatever else you prefer) first. You might have an easier time with the visualisation, because translating things straight out from your head into that tiny pixel rectangle probably won't translate too well.
  2. I'm also faced with this challenge, and have tried on occasion to learn music theory and to play the guitar in an effort to get past this hurdle, but somehow it doesn't seem to be helping with my extremely short attention span.
  3. :chin:
  4. nil
  5. After learning some C# and working in editors that provide automatic indentation, TSC does get to be pretty clutter-y. :toroko2:
  6. nil
  7. Does reading level design articles help you with this? I have read a couple of articles on this (not too many) but it doesn't really seem to help me much. It's sort of like I'm trying to expand the Egg Corridor's linearity by adding more detours around it, but I can't help but think that players will end up complaining about how the level design.
  8. I have seen many of the threads in the showcase subforum, and saw that there were actually many threads from around the 2008 - 2009 period had some people reviewing the mods on quite the regular basis. For example, Xaser's Schism, ZTaimat's Eternal Chaos (both episodes), Metalogz' Magic~ and The Future. Maybe people just expect a certain minimum level of quality before they consider investing their time into writing something truly helpful or encouraging towards the modder. It's been a while since I last checked those threads, but I believe they all had some great screenshots showcasing some fresh and interesting graphics, and on occasion witty dialogue as well (or maybe this is from a demo, I can't remember too well).
Yep, I think that's it.

Thanks again for the valuable insights. When writing the reply I did think a lot more on how I looked at some of the points that I normally didn't pay too much attention to. :mrgreen:
 
Jan 10, 2013 at 2:25 PM
Not anymore
"Run, rabbit run. Dig that hole, forget the sun."
Join Date: Jan 28, 2010
Location: Internet
Posts: 1369
Age: 34
Pronouns: he/him
Hm, it appears that I messed up my numbers.

5. I cannot easily read a programming language with no indentation blocks.
This is x86 assembly.

4. I cannot use a scripting language without integers.
This is TSC because flags are not really integers, they're just bits.
Yeah sure, flags are integers. In the set {0, 1}. A wonderful and very useful set.

As an assembly programmer, I should know that assembly has direct access to strings,
floats, long integers, short integers, especially bytes, and so forth.

Assembly can do absolutely everything. It is the only language your computer
truly understands.

C and C++ work like this:
C/C++ -> compile -> Assembly -> run on the processor.

Python works like this:
Python -> compile (yes really) -> Python bytecode -> interpret with C -> C is already assembly when C is compiled

Mint is crappy and actually works like this:
Mint -> interpret with Java -> Java is just the JVM -> JVM is written in C or something -> C is assembly when C is compiled

The crappy part is the second chunk: directly interpret instead of compile to bytecode.
It is not because of the JVM, because the JVM is pretty damn fast for a software architecture.

There is a dirty little secret that few people know about.

This is how assembly works:
x86 bytecode -> interpret with microcode -> microcode runs the electrical logic gates on your computer.

Yes really! Assembly is not compiled. It's interpreted directly, just like Mint and Python bytecode.
OHHH.... there is no way to compile a program ever! Everything is interpreted with microcode.

If you don't believe me, look up the Intel x86 microcode reference.

MOV ALPHA, BETA
is an assembly instructions that copies the contents of BETA into ALPHA.
MOV is literally one case of a giant microcode switch statement. And the microcode
for MOV is actually pretty humongous (hundreds if not thousands of lines of microcode
just for this single instruction) to account for all the differences in registers and
size of memory locations.

So yes, if you didn't know:

1. All programming languages are text.
2. Many programming languages get converted to bytes.
3. Eventually, those bytes go to the Assembly language level.
4. Finally, the Assembly is directly interpreted by the built-in microcode as a bytecode.

Here is some microcode for the curious:

# Any line starting with a number-sign is a comment
# This is just a label, the ordinary way assemblers symbolically represent a
# memory address.
InstructionJUMP:
# To prepare for the next instruction, the instruction-decode microcode has already
# moved the program counter to the memory address register. This instruction fetches
# the target address of the jump instruction from the memory word following the
# jump opcode, by copying from the memory data register to the memory address register.
# This gives the memory system two clock ticks to fetch the next
# instruction to the memory data register for use by the instruction decode.
# The sequencer instruction "next" means just add 1 to the control word address.
MDR;
NONE;
MAR;
COPY;
NEXT;
NONE;
# This places the address of the next instruction into the PC.
# This gives the memory system a clock tick to finish the fetch started on the
# previous microinstruction.
# The sequencer instruction is to jump to the start of the instruction decode.
MAR;
1;
PC;
ADD;
JMP;
InstructionDecode;
# The instruction decode is not shown, because it is usually a mess, very particular
# to the exact processor being emulated. Even this example is simplified.
# Many CPUs have several ways to calculate the address, rather than just fetching
# it from the word following the op-code. Therefore, rather than just one
# jump instruction, those CPUs have a family of related jump instructions.

Yes we are writing the freaking JMP instruction in microcode.
Also notice that MAR and MDR are the same as CAR and CDR in Lisp.
So basically, your computer runs on Lisp, which interprets x86 assembly. :D
 
Jan 10, 2013 at 5:32 PM
I don't anymore.
"I'm sorry Mario, but your princess is in another castle."
Join Date: Aug 9, 2010
Location: Greener Pastures
Posts: 1188
Age: 30
Why are people so afraid of collaboration? not giant ass community projects, but 2 or 3 people coming up with a cool idea together and filling in the areas where the others are lacking. Putting time and effort in and working for each other instead of just themselves. I suppose knowing the other person well could be a challenge for some people, but I can tell you we would see alot more finished projects or at least ones that are farther along if that was the case.
 
Jan 10, 2013 at 7:42 PM
Veteran Member
"Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-BLEIUP"
Join Date: Aug 21, 2012
Location: At a computer
Posts: 337

tl,dr *shot bricked and hanged*

actually, i read the whole post, So if a cave story remake was made with lisp it would be easy to tweak and fiddle with? On the other hand, i dont have much to say about general modding(No exe hacks), except i think thats actually easy.

Also,

<KEY<MSG how is TSC hard?<NOD<CLR<END
 
Jan 10, 2013 at 8:14 PM
Lvl 1
Forum Moderator
"Life begins and ends with Nu."
Join Date: May 28, 2008
Location: PMMM MMO
Posts: 3713
Age: 32
4. I cannot use a scripting language without integers.
So are you just retarded, or do you just refuse to do anything outside of your comfort zone? You don't really need integers for anything you'd need to do with TSC.
 
Jan 11, 2013 at 12:23 AM
Not anymore
"Run, rabbit run. Dig that hole, forget the sun."
Join Date: Jan 28, 2010
Location: Internet
Posts: 1369
Age: 34
Pronouns: he/him
GIR, write a Python interpreter in TSC that reads Python bytecode from the flagdata, and we'll see how much you enjoy not having anything except boolean variables.

Noxid, you will never achieve great things if you always try to be "rational."

There are so many more irrational numbers than rational numbers. If you try
to be a rational person, you are just a fool left in the dust. Do you think Bill Gates was rational when he thought of Microsoft?
What about Steve Jobs and Apple? Yeah sure, make two of the biggest and most well known billion-dollar
companies in the entire world. And revolutionize the computer industry while doing that. Do you think those two were rational at all?

EDIT: Also Nox, how are you rational? "Oh, let me just write an editor in Java that can improve on CaveEditor's features. It should work for my game, CS+, the regular CS, and also be cross-platform when it's finally complete".

Yes, that is extremely rational Noxid. Not even I am willing to do that.
 
Jan 11, 2013 at 1:23 AM
Administrator
Forum Administrator
"Life begins and ends with Nu."
Join Date: Jul 15, 2007
Location: Australia
Posts: 6224
Age: 39
Pronouns: he/him
Carrotlord said:
The reason C++ is beautiful is because it's not beautiful at all. Just like PHP.
PHP is a hell of a lot better than C++ as it doesn't have C++'s irritatingly strict and messy typing.

C++:
Oh. I need to turn a char array into a string? Lets write an 6 line long function for that.
Oh. I need to turn a string into an int? Lets write an 6 line long function for that.
Oh. I need to turn an int into a boolean? Lets write an 6 line long function for that.
Oh. I need to turn a char array into an int? Lets write an 6 line long function for that.
Oh. I need to do the reverse? Lets write four 6 line long functions for that.
Oh s**t. Why did the int suddenly become signed.
Why can't the function parameter typing be looser?
Why can't I have optional function parameters?
F**k you C++!

PHP:
One line.
One line.
One line.
One line.
..and so forth.

I personally find PHP to be no worse than Javascript if you avoid the OOP stuff.
 
Jan 11, 2013 at 2:16 AM
Lvl 1
Forum Moderator
"Life begins and ends with Nu."
Join Date: May 28, 2008
Location: PMMM MMO
Posts: 3713
Age: 32
Carrotlord said:
GIR, write a Python interpreter in TSC that reads Python bytecode from the flagdata, and we'll see how much you enjoy not having anything except boolean variables.
GIRakaCHEEZER said:
So are you just retarded, or do you just refuse to do anything outside of your comfort zone? You don't really need integers for anything you'd need to do with TSC.
Why would you ever write a Python interpreter in TSC? That would just be an exercise in retardation.

TSC was made for scripting text/story events in Cave Story, and it does that perfectly fine. If you're trying to use TSC as an actual programming language, there is something seriously wrong with you.
 
Jan 11, 2013 at 3:20 AM
Not anymore
"Run, rabbit run. Dig that hole, forget the sun."
Join Date: Jan 28, 2010
Location: Internet
Posts: 1369
Age: 34
Pronouns: he/him

PHP is my most hated language.



$ in front of variables? Are you Perl?

. to concatenate strings? What? I can't use the plus sign like all the other languages?

-> for objects? Are you C with structs?

Everything in the library is functions? Are you Lisp?

You have methods too? That means you are JavaScript as well.

If you're also JavaScript, then why are all the library functions not OOP? ... ARGH!!!

Semicolons required? I thought you were a scripting language!



It makes no sense and does not have unity built into it.

It's like everyone decided to smash all the languages together

and got rid of every useful feature that those languages did have.

JavaScript is a much better language than PHP. So is C, C++, and Brainfuck.



The only thing that is about as bad as writing PHP is writing regexes with tons

of backslashes in them. In PHP.



<?php echo "<script type=\"text/javascript\">document.write(\"</rant>\")</script>"; ?>



If TSC is supposed to be a scripting language, then it should be just

as useful as Python for general desktop programming, as well as running servers.



I mean, it's not dedicated for exactly one purpose, like Game Maker Language, is it?

Oh wait, it is dedicated to exactly one purpose. Cave Story. Whoops. :balrog:
 
Jan 11, 2013 at 3:56 AM
I don't anymore.
"I'm sorry Mario, but your princess is in another castle."
Join Date: Aug 9, 2010
Location: Greener Pastures
Posts: 1188
Age: 30
(Looks at title, looks at thread content)

You guys suck.
 
Jan 12, 2013 at 7:35 AM
Administrator
Forum Administrator
"Life begins and ends with Nu."
Join Date: Jul 15, 2007
Location: Australia
Posts: 6224
Age: 39
Pronouns: he/him
Carrotlord said:
$ in front of variables? Are you Perl?
It makes sense. This way you cannot create conflict with existing functions or objects. I've had a number of situations with javascript where I used the name of a preset property in javascript for a variable and it took forever to find the issue.
Carrotlord said:
. to concatenate strings? What? I can't use the plus sign like all the other languages?
+ to concatinate strings? Hell no. That was always a stupid idea. + should only be used for mathematical operations. '1'+1 should not equal 11. Or hey, try concatenating two integers with the plus operator in javascript without introducing a string or converting to a string.
Carrotlord said:
-> for objects? Are you C with structs?
Why not ->? -> indicates containment of the object, property, or method within said object.
Carrotlord said:
Everything in the library is functions? Are you Lisp?

You have methods too? That means you are JavaScript as well.
If you're also JavaScript, then why are all the library functions not OOP? ... ARGH!!!
Why confine a method (function) to an object based on your variable type when you can, with php's loose typing, use it with multiple of variable types. All variable types except for objects can be easily represented as other types. This loose typing is the same with Javascript but PHP brings it to the next level by allowing you to use any variable type in any property of any function available to any variable type because its library isn't OOP based.
Carrotlord said:
Semicolons required? I thought you were a scripting language!
It is NOT a scripting language. When a page is requested the code is compiled into html and the compiled html is returned. It is a programming language that compiles into a scripting language instead of an executable. This is how all these server-side languages work. Though some people would argue that if it doesn't compile to an executable that it isn't a programming language, but regardless it isn't a scripting language.
Carrotlord said:
It makes no sense and does not have unity built into it.
I beg to differ. It is consistent in its approach. C++ on the other hand is a mess.
Carrotlord said:
It's like everyone decided to smash all the languages together and got rid of every useful feature that those languages did have.
Name one. I bet I could prove you wrong.
Carrotlord said:
JavaScript is a much better language than PHP. So is C, C++, and Brainfuck.
C++ is Brainfuck.
Carrotlord said:
The only thing that is about as bad as writing PHP is writing regexes with tons
of backslashes in them. In PHP.

<?php echo "<script type=\"text/javascript\">document.write(\"</rant>\")</script>"; ?>
<? echo '<script type="text/javascript">document.write("</rant>");</script>'; ?>

Or you could use the heredoc method for quoting strings.

http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
Carrotlord said:
If TSC is supposed to be a scripting language, then it should be just
as useful as Python for general desktop programming, as well as running servers.
No because it is not a general scripting language.
Carrotlord said:
I mean, it's not dedicated for exactly one purpose, like Game Maker Language, is it?
Oh wait, it is dedicated to exactly one purpose. Cave Story. Whoops. :balrog:
Doesn't mean that it isn't a scripting language.
 
Jan 12, 2013 at 3:28 PM
Not anymore
"Run, rabbit run. Dig that hole, forget the sun."
Join Date: Jan 28, 2010
Location: Internet
Posts: 1369
Age: 34
Pronouns: he/him
I did the backquoting on purpose. I know you can do single quotes and fancy Perl like things.
However, I have stopped using PHP pretty much.
My website still has lots of PHP files, but those were transpiled (translationally compiled) from a different language.

If you look at my Github, most of my server side scripts are written in my own language.
https://github.com/Carrotlord/OliverChu-dot-com/blob/master/CodeHiveBuilder_index.html

Also, I prefer strongly typed (but still dynamically typed) Python.
If you do "1" + 1, it gives you an error. However, "8" + "1" gives 81, and 8 + 1 gives 9.
But you cannot add numbers and strings unless you convert them using casting (coercion) functions.
My language works the same way, since it is partly inspired by Python.

Also, the inability to use $haha($someArgument) in PHP really annoys me. If $haha is a string that contains the
name of a function, such as "file_get_contents", it should call that function.

You are forced into using the uglier eval syntax of PHP.

Python also has an eval:
some_file_contents = eval(haha + "('" + someArgument + "')")

So does JavaScript.

And in Mint, you can often avoid the eval:
someFileContents = ("return " + haha + "()").call()

You could do either eval or calling a string as if it were an isolated function.

Some people say eval is nasty, and that calling a string as code should never be allowed.

But technically, it's really powerful.
You don't need arrays anymore with eval.

Code:
some_name = "my_fake_array_"
some_number = 0
# array[0] = 283
eval(some_name + str(some_number) + " = 283")
# array[1] = 99
eval(some_name + str(some_number + 1) + " = 99")
print(my_fake_array_0)
print(my_fake_array_1)
 
Jan 13, 2013 at 3:48 AM
Not anymore
"Run, rabbit run. Dig that hole, forget the sun."
Join Date: Jan 28, 2010
Location: Internet
Posts: 1369
Age: 34
Pronouns: he/him
brainfuck is fairly elegant. Only has a handful of very simple instructions, and acts very much like assembly, but looks nicer.
C++ is brainfuck because it fucks with your brain, and isn't elegant at all.
 
Jan 13, 2013 at 11:40 AM
Administrator
Forum Administrator
"Life begins and ends with Nu."
Join Date: Jul 15, 2007
Location: Australia
Posts: 6224
Age: 39
Pronouns: he/him
Carrotlord said:
Also, the inability to use $haha($someArgument) in PHP really annoys me. If $haha is a string that contains the
name of a function, such as "file_get_contents", it should call that function.
<?
$someArgument='testfv.txt';
$haha='file_get_contents';
echo $haha($someArgument);
?>
Like this?

It works btw.
Carrotlord said:
Some people say eval is nasty, and that calling a string as code should never be allowed.
You can't blame them really. Eval is powerful, but it is also a massive security risk in the hands of the uninitiated.
 
Jan 13, 2013 at 5:23 PM
Not anymore
"Run, rabbit run. Dig that hole, forget the sun."
Join Date: Jan 28, 2010
Location: Internet
Posts: 1369
Age: 34
Pronouns: he/him
That actually makes little sense. I would expect that to print the function call as a string.
The only difference is that there are no quotes around it, so it does evaluate properly. It's a little hard to read frankly, but it's good to have that feature.
Most of the things I hate about PHP are inherited from Perl. So I guess I just don't like Perl's design and syntax.

EDIT: Also, PHP short tags? Really Andwhy? This is how you built the CSTSF? I am ashamed, to be honest.
 
Jan 13, 2013 at 11:54 PM
Administrator
Forum Administrator
"Life begins and ends with Nu."
Join Date: Jul 15, 2007
Location: Australia
Posts: 6224
Age: 39
Pronouns: he/him
Carrotlord said:
EDIT: Also, PHP short tags? Really Andwhy? This is how you built the CSTSF? I am ashamed, to be honest.
I am yet to come across a build of php that didn't have short tags enabled in this day and age since they are a default in all current php releases. Furthermore xhtml is very much dead and any xml header conflicts that caused people to shun short tags voided.

I only use short tags as a shorthand for <?php though. I don't do <?=, always <? echo.
Carrotlord said:
That actually makes little sense. I would expect that to print the function call as a string.
file_get_contents() returns the contents as a string. If you want to directly print the file contents then you should have used readfile().

http://php.net/manual/en/function.readfile.php
http://php.net/manual/en/function.file-get-contents.php
 
Back
Top