Page 1 of 1

How to visit another House

Posted: Tue Mar 05, 2013 6:20 pm
by C3PO
Hello

I figured out that with

Code: Select all

Houses_VisitHouseRequest(HouseID,Password)
you could go into another house, BUT I always get the output

Code: Select all

Command> RoMScript("Houses_VisitHouseRequest( USERNAME,"");")
Invalid Command
The Houses_VisitHouse Frame is shown. When I test the function in RoM it works, but not with the bot.

Re: How to visit another House

Posted: Tue Mar 05, 2013 6:44 pm
by lisa
first " starts the string, the second " ends the string, so you would need to use ' instead of " as you have " as part of the string.

Code: Select all

RoMScript('Houses_VisitHouseRequest( USERNAME,"");')
That is assuming you are going to use the actual name instead of USERNAME, if you are having it as a variable then you need to exit the string to use it.

Code: Select all

USERNAME = "Awesomeness"
RoMScript('Houses_VisitHouseRequest( '..USERNAME..',"");')

Re: How to visit another House

Posted: Tue Mar 05, 2013 8:35 pm
by C3PO
Thanks again Lisa

... and shame on me, such a stupid failure ... but it was a hard day :(

OK the Failure "Invalid Command" is missing, but still nothing happens. MicroMacro is waiting ...

Code: Select all

RoMScript('Houses_VisitHouseRequest("Awesomeness","");')

Re: How to visit another House

Posted: Tue Mar 05, 2013 10:14 pm
by lisa
try using sendMacro instead of RoMScript, I vaguely remember something about ROMScript expecting a returned value but sendMacro just sends the command and doesn't expect anything in return.

Re: How to visit another House

Posted: Tue Mar 05, 2013 10:20 pm
by C3PO
still the same

Code: Select all

Command> sendMacro('Houses_VisitHouseRequest("Lisa","");')
[color=#008000]Drücke MACRO: RoMScript ausführen "Houses_VisitHouseRequest("Lisa","")".[/color]

Re: How to visit another House

Posted: Tue Mar 05, 2013 10:29 pm
by lisa
yeah testing it myself now, not sure why but if the pop up for going to another house is open when you do the command it just sits there but when you close the popup MM then continues on.

I made a macro in game and it worked fine, need some testing.

Re: How to visit another House

Posted: Tue Mar 05, 2013 11:16 pm
by lisa
ok so my current theory is that you can't actually use/edit the macro system while the join house popup is active, I tried to just do a simple sendMacro("SendSystemChat('lol')") but it also just sat there until I closed the popup.

So I am thinking you will need to actually do keypresses to enter the "House owner or house number" and then use enter, you can use tab to go to the password section.

Rock did some work on doing key presses to enter details in his autologin thingy, maybe check it out for examples on how to do it. I think that will be the only way to get it working.


Yep it won't do macros if an editbox has focus, it then tries to close it using escape but escape won't close that popup.

Just remember for the first character of name to do a capital using the second arg of keyboardPress

Code: Select all

keyboardPress(key.VK_A,key.VK_SHIFT)
keyboardPress(key.VK_W)
keyboardPress(key.VK_E)
keyboardPress(key.VK_S)
keyboardPress(key.VK_O)
keyboardPress(key.VK_M)
keyboardPress(key.VK_E)
keyboardPress(key.VK_N)
keyboardPress(key.VK_E)
keyboardPress(key.VK_S)
keyboardPress(key.VK_S)
keyboardPress(key.VK_ENTER)
Awesomeness

Re: How to visit another House

Posted: Wed Mar 06, 2013 12:23 am
by rock5
lisa wrote:try using sendMacro instead of RoMScript, I vaguely remember something about ROMScript expecting a returned value but sendMacro just sends the command and doesn't expect anything in return.
Um, I don't think so. The only difference between RoMScript and sendMacro is sendMacro prints a message.
lisa wrote:ok so my current theory is that you can't actually use/edit the macro system while the join house popup is active
Edit boxes kill the bot because the macro system requires a keypress to action the macro. The way I'm dealt with this in the past is to clear the focus in the same command that opens the edit box.

Code: Select all

RoMScript("} ChoiceOption(3); z = GetKeyboardFocus(); if z then z:ClearFocus() end a={") 
In this case thought it doesn't work. I think the box takes too long to open so the clearfocus happens before it opens. So maybe Lisas way is the only way. But maybe we could make a function that breaks down a string and does it for you.

Re: How to visit another House

Posted: Wed Mar 06, 2013 12:40 am
by lisa
rock5 wrote:So maybe Lisas way is the only way. But maybe we could make a function that breaks down a string and does it for you.
I actually thought you already did code for that when doing your login thingy.
My first thought is to just have a table with the characters and corresponding numbers.

other thought is to try to use the string in the key.VK_ code, I think this would be complicated.

So you can assume with any character name the first character is caps and the rest lowercase, no spaces.

So you could simply do up a table and then when "disecting" the string into single characters you do the first as uppercase and the rest as lowercase.

It is of course possible and might be a little fiddley.
Something that might help the person doing it is you can get the key number for characters with getKeyName

Code: Select all

for i = 0,255 do
print(i..": "..getKeyName(i))
end
I would simply do a function to create a table but that is just me ;)
Note some will be blank which could be shift and such but you don't need those anyway.

looks like this

Code: Select all

0:
1:
2:
3: Scroll Lock
4:
5:
6:
7:
8: Backspace
9: Tab
10:
11:
12: Num 5
13: Enter
14:
15:
16: Shift
17: Right Ctrl
18: Right Alt
19:
20: Caps Lock
21:
22:
23:
24:
25:
26:
27: Esc
28:
29:
30:
31:
32: Space
33: Page Up
34: Page Down
35: End
36: Home
37: Left
38: Up
39: Right
40: Down
41:
42:
43:
44: Sys Req
45: Insert
46: Delete
47:
48: 0
49: 1
50: 2
51: 3
52: 4
53: 5
54: 6
55: 7
56: 8
57: 9
58:
59:
60:
61:
62:
63:
64:
65: A
66: B
67: C
68: D
69: E
70: F
71: G
72: H
73: I
74: J
75: K
76: L
77: M
78: N
79: O
80: P
81: Q
82: R
83: S
84: T
85: U
86: V
87: W
88: X
89: Y
90: Z
91: Left Windows
92: Right Windows
93:
94:
95:
96: Num 0
97: Num 1
98: Num 2
99: Num 3
100: Num 4
101: Num 5
102: Num 6
103: Num 7
104: Num 8
105: Num 9
106: Num *
107: Num +
108:
109: Num -
110: Num Del
111: Num /
112: F1
113: F2
114: F3
115: F4
116: F5
117: F6
118: F7
119: F8
120: F9
121: F10
122: F11
123: F12
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144: Pause
145: Scroll Lock
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160: Shift
161: Right Shift
162: Right Ctrl
163: Right Ctrl
164: Right Alt
165: Right Alt
166:
167:
168:
169:
170:
171:
172: M
173: D
174: C
175: B
176: P
177: Q
178: J
179: G
180:
181:
182:
183: F
184:
185:
186: ;
187: =
188: ,
189: -
190: .
191: /
192: `
193:
194: F15
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219: [
220: \
221: ]
222: '
223:
224:
225:
226: \
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
I should mention you can use that number instead of the key.VK_A

Re: How to visit another House

Posted: Wed Mar 06, 2013 12:42 am
by rock5

Code: Select all

function enterName(str)
	str = string.upper(str)

	-- Type all characters
	for i = 1, #str do
		keyboardPress(string.byte(str,i))
	end

	-- Press Enter
	keyboardPress(key.VK_ENTER)
end
Turns out the first character doesn't need to be capital. Just as well, shift didn't work. Probably the old problem of using modifiers in rom.

Re: How to visit another House

Posted: Wed Mar 06, 2013 12:48 am
by lisa
pfft that is to easy, you need to do things the hard way like me ;)

If you use second arg like I mentioned, the capitals works fine.

Code: Select all

keyboardPress(string.byte(str,1),key.VK_SHIFT) 
for i = 2, #str do keyboardPress(string.byte(str,i)) end

Which reminds me, wasn't there some discussion about checking if caps lock was on when doing keypresses?

Re: How to visit another House

Posted: Wed Mar 06, 2013 1:24 am
by rock5
lisa wrote:If you use second arg like I mentioned, the capitals works fine.
Actually I did a bit more testing and it seemed to be working. For some reason the first time I wrote the function, similar to what you just wrote, it didn't capitalize it so I thought it didn't work.
lisa wrote:Which reminds me, wasn't there some discussion about checking if caps lock was on when doing keypresses?
I remember mentioning it but I don't remember if it was fixed. Looks like it wasn't. I'll bring it up again with Administrator.

Re: How to visit another House

Posted: Wed Mar 06, 2013 9:28 am
by lisa
I thought your code was easy compared to mine, seems Admin has even easier

Code: Select all

local charname = "Awesomeness"
local pass = "somepass" 
keyboardType(charname)
keyboardPress(key.VK_TAB)
keyboardType(pass)
keyboardPress(key.VK_ENTER)
It even does the capitals

Re: How to visit another House

Posted: Wed Mar 06, 2013 11:20 am
by C3PO
Thanks a lot for your help!

After your analysis I found out a more ... solution

Code: Select all

Command> RoMScript('ChoiceOption(4);Houses_VisitHouseRequest("Lisa","");')
and it works fine.
But I found a userfunction that would also help
http://www.solarstrike.net/phpBB3/viewt ... ter#p22630