View Single Post
  #35    
Old January 12th, 2012 (10:50 PM).
Darthatron's Avatar
Darthatron Darthatron is offline
巨大なトロール。
Silver Tier
 
Join Date: Jan 2006
Location: Melbourne, Australia
Age: 23
Gender: Male
Nature: Modest
Posts: 1,152
Quote originally posted by hinkage:
Don't bother incorporating loops. I can't imagine any scripts that would use them other than to spam msgbox's or something, and technically loops are already possible using the "jump" or "goto" commands. Although those are bad programming style, they work, and you can do loops just fine.
It's all compiled into jump's and call's anyway. It's just considered ugly and hard to read.
Quote originally posted by tinix:
Well I dont really think it would be painful at all. Before I posted that idea Ive tried to throw together a little program in C# that would load an assembly that has specified entry point and invoke the entry point of assembly. (Essentialy the idea of plugin system was an DLL written in .NET language with specified entry point that would get invoked from the main program) The code for loading the DLL is 6 lines long:
Spoiler:

Code:
 
 
string path = Assembly.GetEntryAssembly().Location;
string[] s = path.Split('\\');
path = path.Remove(path.Length - s[s.Length - 1].Length, s[s.Length - 1].Length);
Assembly a = Assembly.LoadFile(path + "test.dll");
MethodInfo m = a.EntryPoint;
m.Invoke(null, null/*Here could go pointer to main form, or exposable data structure or whatever*/);


This would need little modifications to work in the editor but it is the essential part of it.
And to your response that it will be opensource. That is a good thing, but plugin manager is useful anyway, because if you will release a new version with lets say important bugfix in compiler code, some people could be using modified branch of editor with ASM compiler and syntax highlithing for example. If the modification would be plugin the person that is using it just needs to load it in new version. But if it would be a fork of the source, then they would need to wait for a day or two for new modified version or give up their modification and upgrade instantly. So you need to consider this fact.
Well... You make valid points. Maybe I shouldn't assume something is difficult just because I've never tried it before. Thanks.
Quote originally posted by droomph:
Well mainly I wouldn't need loops, I was bored one day and thought "maybe me could implements something like C into it! durr" And this is what exploded out of that.

And #include, #define, and such were out of the question, so I thought maybe...bleh

Anyways, whatever not important

The only C elements we'll (as in noobs like me) need, if at all, are these...
Spoiler:
A simple shorthand for if...then, else (as in no compare crap in front of if1s and if2s)
Spoiler:
Code:
@if
if variable condition number
	then statement
	else statement2

next
Code:
@if
	compare variable number
	if1 condition @then
	jump @else

	@then
	statement
	jump @return

	@else
	statement2
	jump @next

	@next


A neater switch, case n, default
Spoiler:
Code:
@switch
switch variable condition number
	case condition:
		statementcase condition2:
		statement2
…
…
…
…
	default:
		statement3	return '}

next
Code:
	@swtich
	compare variable number
	if1 condition @case
	if1 condition2 @case2
…
	call @default
	jump @next

	@case
	statement
	jump @statement2

	@case2
	statement2
	jump @…

…
	jump @default

	@default
	statement3
	jump @next

	@next
possibly break;

Code:
breaknext
Code:
	goto @next
	…
	@next


variable++ (just easier to read, nothing much)
Spoiler:
Code:
…
variable++

or

…
variable increment
Code:
addvar variable 0x1
Code:
variable operate variable2++
Code:
	operate variable
	addvar variable2
Code:
variable operate ++variable2


And if only absolutely necessary (I can't think of a place where we'll use this):

A neater if...continue
Spoiler:
Code:
@continue
while variable condition number
	statement
	if variable2 condition2 number2
		then continue
	statement2
	return

next
Code:
	@while
	compare variable number
	if1 condition @loop
	jump @next

	@loop
	statement
	compare variable2 number2
	if1 condition2 @loop2
	jump @next

	@loop2
	statement2
	compare variable number
	if1 condition @loop
	jump @next

	@next


And maybe some popular combination instructions (derp)...

condensed lock and faceplayer instructions, as we use them together 90% of the time anyways
Spoiler:
Code:
lockf ;or similar codename
Code:
	lock
	faceplayer
oh right lockall exists too but you know what I mean don't you


And maybe do...while but that's just me.


But just a few ideas from a guy who likes to keep stuff easy.

Anyone can do this on their own, I thought it might be nice.

Apparently I'm wrong. *oh well* *shrugs*

I guess I'll shut up right about now
This post was incredibly helpful, actually. You've made me reconsider how I'm going to implement this. Screw conforming to the current scripting styles, I should just make a logical, flowing scripting language.

You've impressed me.
__________________
あなた は しきしゃ です
わたし は ばか です