Making custom commands in ROTMG

Posts 1–15 of 16 · Page 1 of 2
Making custom commands in ROTMG
Well I figured out how to do this. I'm posting this more as a reference for me and those who care. Code is for v123.5.1.

The function that checks for client side commands is com.company.assembleegameclient.ui:_-4D/_-2T . If the command isn't seen there it is sent to the server at which point if it isn't recognized the player will be greeted with an unrecognized command message in the text box. If you look at the function there is only one command check present, that is the "/help" command. To add your own command all you need to do is add a check for the command you want and implement the desired functionality.

In this example, I allow for adjustments to the viewing distance in the fullscreen hack with a console command. It makes various checks for "/vd", the command I want to use to adjust viewing distance, after which it will set a variable that I made in com.company.assembleegameclient.map:_-0Dv (the class responsible for the viewing distance). Finally it will state the setting to the user via the text box.

The code I used in com.company.assembleegameclient.ui:_-4D/_-2T is provided below. It is placed at the start of the code section of the function.

Code:
	; -------- Making your own commands --------
	; If one of our commands are found make
	; sure to return true else the command will
	; be sent to the server and the player will 
	; be greeted with unrecognized command.
	; ------------------------------------------
	
	getlocal1
	pushstring			"/vd"
	ifeq				STATE_VD
	
	getlocal1
	pushbyte 0
	pushbyte 4
	callproperty		QName(Namespace("http://adobe.com/AS3/2006/builtin"), "slice"), 2 ; stack now holds the first three characters in string
	pushstring			"/vd "
	ifne				NOT_VD
	
	findpropstrict		QName(PackageNamespace(""), "int")
	getlocal1
	dup
	pushbyte 4
	swap
	getproperty			QName(PackageNamespace(""), "length")
	callproperty		QName(Namespace("http://adobe.com/AS3/2006/builtin"), "slice"), 2
	callproperty		QName(PackageNamespace(""), "int"), 1
	dup
	setlocal			4 ; holds wanted setting
	
	pushint 			1
	iflt				STATE_VD ; lower bounds check
	
	getlocal			4
	pushint				255
	ifgt				STATE_VD ; upper bounds check

	getlex				QName(PackageNamespace("com.company.assembleegameclient.map"), "_-0Dv")
	getlocal			4
	setproperty			QName(PackageNamespace(""), "vd_") ; sets wanted setting
	
STATE_VD:
	getlocal0
	getlex				QName(PackageNamespace("com.company.assembleegameclient.parameters"), "Parameters")
	getproperty			QName(PackageNamespace(""), "_-Nv")
	pushstring			"Viewing Distance: "
	getlex				QName(PackageNamespace("com.company.assembleegameclient.map"), "_-0Dv")
	getproperty			QName(PackageNamespace(""), "vd_")
	add
	callpropvoid		QName(PackageNamespace(""), "addText"), 2
	
	pushtrue
	returnvalue
	
NOT_VD:
Taking a look at the directions I provided for implementing the fullscreen hack. There is a part in there that says:

Expanding your Horizon (Part 2)-
com.company.assembleegameclient.map:_-0Dv._-K
From the end (returnvoid) scan up for the instuction "pushbyte 1". Replace with a larger number. This is one of those variables that need to be optimized depending on desired resolution one wants to play at. (16 seems to be good for 1920x1080)
Instead of hard coding the value into the client, I made a variable that will hold the desired value. Here I replaced pushbyte 1 with getlex QName(PackageNamespace(""), "vd_") (vd_ is my variable name). Then at the bottom of the file along with all the trait const references I made a new line and placed this trait slot QName(PackageNamespace(""), "vd_") slotid 6 type QName(PackageNamespace(""), "int") value Integer(16) end there. Basically this sets up a static variable of type int with the value of 16 (the default value I wanted).

That it. To change the viewing distance in game just type /vd 12 or whatever the desired viewing distance number wanted.
Nilly, can you please do a full tutorial on Flash Assembly, as a separate thread? I have learned much, but stacks still confuse me a lot!
Also, nice code..
Im sure I'm asking for too much... but is auto spell on Wizard Implementable??
I'm by no means an expert at flash assembly but I think I've gotten to the point where I can get around pretty well. Perhaps I'll make a tut on what I've learned but it isn't on the forefront of my to do list.

I'm playing around with class spells atm. If I make any progress, auto-spell wiz shouldn't be hard.
Quote Originally Posted by nilly View Post
I'm by no means an expert at flash assembly but I think I've gotten to the point where I can get around pretty well. Perhaps I'll make a tut on what I've learned but it isn't on the forefront of my to do list.

I'm playing around with class spells atm. If I make any progress, auto-spell wiz shouldn't be hard.
@nilly, If you do add auto-spell, I highly suggest you not release it to the public. It will ruin the game as there will be a bunch of little kids running around auto-spelling everything. Takes no skill to "play" the game anymore and will make it much harder for legit people to get drops from bosses.
Quote Originally Posted by flyrocket View Post
@nilly, If you do add auto-spell, I highly suggest you not release it to the public. It will ruin the game as there will be a bunch of little kids running around auto-spelling everything. Takes no skill to "play" the game anymore and will make it much harder for legit people to get drops from bosses.
Couldn't agree more. However, would you be able to adjust the current regular commands in the game to whatever command you want?
Quote Originally Posted by flyrocket View Post
@nilly, If you do add auto-spell, I highly suggest you not release it to the public. It will ruin the game as there will be a bunch of little kids running around auto-spelling everything. Takes no skill to "play" the game anymore and will make it much harder for legit people to get drops from bosses.
flyrocket is right on the money. Autospell is definitely not something to release to the public. Instant 2.4k damage by standing near an enemy without any kind of input is game-breaking.
Oh thanks for this! I'll be playing around with this.
Never said I'd release it. I've been picking and choosing what I release and what I don't. I definitely don't want to put something out there that I feel will break the game.
Well, Autospell could be easily done, if I wasn't having problems with these low level languages and finding the correct places to put the code...
Quote Originally Posted by nilly View Post
Code:
	; -------- Making your own commands --------
	; If one of our commands are found make
	; sure to return true else the command will
	; be sent to the server and the player will 
	; be greeted with unrecognized command.
	; ------------------------------------------
	
	getlocal1
	pushstring			"/vd"
	ifeq				STATE_VD
	
	getlocal1
	pushbyte 0
	pushbyte 4
	callproperty		QName(Namespace("http://adobe.com/AS3/2006/builtin"), "slice"), 2 ; stack now holds the first three characters in string
	pushstring			"/vd "
	ifne				NOT_VD
	
	findpropstrict		QName(PackageNamespace(""), "int")
	getlocal1
	dup
	pushbyte 4
	swap
	getproperty			QName(PackageNamespace(""), "length")
	callproperty		QName(Namespace("http://adobe.com/AS3/2006/builtin"), "slice"), 2
	callproperty		QName(PackageNamespace(""), "int"), 1
	dup
	setlocal			4 ; holds wanted setting
	
	pushint 			1
	iflt				STATE_VD ; lower bounds check
	
	getlocal			4
	pushint				255
	ifgt				STATE_VD ; upper bounds check

	getlex				QName(PackageNamespace("com.company.assembleegameclient.map"), "_-0Dv")
	getlocal			4
	setproperty			QName(PackageNamespace(""), "vd_") ; sets wanted setting
	
STATE_VD:
	getlocal0
	getlex				QName(PackageNamespace("com.company.assembleegameclient.parameters"), "Parameters")
	getproperty			QName(PackageNamespace(""), "_-Nv")
	pushstring			"Viewing Distance: "
	getlex				QName(PackageNamespace("com.company.assembleegameclient.map"), "_-0Dv")
	getproperty			QName(PackageNamespace(""), "vd_")
	add
	callpropvoid		QName(PackageNamespace(""), "addText"), 2
	
	pushtrue
	returnvalue
	
NOT_VD:
Are you sure that code works for you? The thing is... theres only 4 locals in _-2T, and you're referencing local #5 when calling
Code:
setlocal 4 ; holds wanted setting
I had to change it to setlocal 3 for it to work, this is the functions preamble:
Code:
     maxstack 5
     localcount 4 ; Theres only 4 locals (local0, local1, local2, local3)! So setlocal 4 won't work because thats the fifth local
     initscopedepth 9
     maxscopedepth 10
Quote Originally Posted by Basillius View Post
Are you sure that code works for you? The thing is... theres only 4 locals in _-2T, and you're referencing local #5 when calling
Code:
setlocal 4 ; holds wanted setting
I had to change it to setlocal 3 for it to work, this is the functions preamble:
Code:
     maxstack 5
     localcount 4 ; Theres only 4 locals (local0, local1, local2, local3)! So setlocal 4 won't work because thats the fifth local
     initscopedepth 9
     maxscopedepth 10
Oh good catch. Yes, you need to do that. I forgot I increased the local count.
Well, trying to do a code with fame gain shown like EXP... and seriously failing!
That will help but this isn't exactly assembly. I would look for something more conceptual than to learn about all the different instructions of assembly. Learning assembly would be helpful though if you want to hack things built on non-interpreted languages.

I don't know if you ever looked at this: http ://www.nowrap.de/flasm.html#flashvm . It might help.
This could be used to make a configuarble autonexus?
Posts 1–15 of 16 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?