putting text to the CLI without hitting enter?

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

OnyxSkyDV
a lesser mummy
a lesser mummy
Posts: 46
Joined: Wed Sep 18, 2002 1:02 pm

putting text to the CLI without hitting enter?

Post by OnyxSkyDV » Tue Jul 01, 2003 1:31 pm

would it be possible for your macro to put text to the command / chat line and leave it there without hitting enter so that text is just sitting there waiting for the enter to send it?

Example, once the macro starts it puts "/end" to the command line, but leaves it there so all you would need to do would be hitting the enter key to send the end command?

Just a question, thanks much!

OnyxSkyDV

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Tue Jul 01, 2003 2:00 pm

Code: Select all

Sub Main
/press /
/press e
/press n
/press d
| your code goes here
/return

OnyxSkyDV
a lesser mummy
a lesser mummy
Posts: 46
Joined: Wed Sep 18, 2002 1:02 pm

thanks!

Post by OnyxSkyDV » Tue Jul 01, 2003 3:47 pm

Right on! Let me throw this in and test tonight. :)

Thanks much!

OnyxSkyDV

kagonis
a hill giant
a hill giant
Posts: 228
Joined: Sat May 24, 2003 8:48 pm

Post by kagonis » Tue Jul 01, 2003 4:26 pm

To make it easy you could make a sub routine to do it, like this:

Code: Select all

Sub Main
	/call TypeString "/endmacro"
/return

Sub TypeString
	/if n $strlen($p0)==0 {
		/echo Syntax: /call TypeString "My String Here"
		/endmacro
	}
	/press Enter
	/for l0 0 to $calc($strlen($p0)-1)
		/press $mid($l0,1,$p0)
	/next l0
/return

OnyxSkyDV
a lesser mummy
a lesser mummy
Posts: 46
Joined: Wed Sep 18, 2002 1:02 pm

info?

Post by OnyxSkyDV » Tue Jul 01, 2003 6:07 pm

Forgive my ignorance, I'm trying to read through your sub, and having a hard time of it...

I can see you call a sub to put the text to the CLI, and that you check that the variable has length to it to verify that something was entered, but the last part throws me..

/press Enter
/for l0 0 to $calc($strlen($p0)-1)
/press $mid($l0,1,$p0)
/next l0
/return

Does this walk through the string you've entered, entering the first character, and looping while adding one to the value of the position till it types out your entire string?

Just wanted to verify, Thanks much!

OnyxSkyDV

kagonis
a hill giant
a hill giant
Posts: 228
Joined: Sat May 24, 2003 8:48 pm

Post by kagonis » Tue Jul 01, 2003 6:33 pm

Yes, that's exactly what it does.

$calc($strlen($p0)-1) calculates the length of your string (substracting 1 since we start at 0 and not at 1), then adding 1 on each iteration, until we have run the loop the number of times that is the same as the length of the string.

User avatar
BlueSkies
a ghoul
a ghoul
Posts: 132
Joined: Tue Oct 01, 2002 6:22 pm

Post by BlueSkies » Wed Jul 02, 2003 1:26 am

Wow! Someone who wants to learn instead of leech!

I like this guy! :)
Live your dreams! Blue Skies everyone

OnyxSkyDV
a lesser mummy
a lesser mummy
Posts: 46
Joined: Wed Sep 18, 2002 1:02 pm

thanks. :)

Post by OnyxSkyDV » Wed Jul 02, 2003 1:42 pm

Heh, thanks. Trying to learn, but since my coding skills can be compared to a toddler on robotussin, I'm not the fastest learner out there... :)

I'll get it figured out sometime though, the help that is provided here is much appreciated!

Have a great one guys!

OnyxSkyDV

User avatar
BlueSkies
a ghoul
a ghoul
Posts: 132
Joined: Tue Oct 01, 2002 6:22 pm

Post by BlueSkies » Wed Jul 02, 2003 5:56 pm

Keep it up!

I'm just learning C++ (I do have a strong VB coding background -- but this is still mostly alien territory) -- and a Jala and I got the new INI file functionality working. :P Granted, it's probably something anybody could do, and it did have its problems (Valerian helped us out once we got a working product to trim down) but it worked nonetheless.

Just recently I've been looking into learning asm so I can help with the more important functionality, but that's probably going to be a long process... *shrugs* Maybe if someone is interested in taking on an eager young coder (ok, not so young...) I'll get a boost on that. :P But that's unlikely, hehe
Live your dreams! Blue Skies everyone