Forums » Community Projects

Make Friends, v1.0.0

«123»
Jul 04, 2007 MSKanaka link
Yeeeah. RegisterUserCommand() is broken, last I checked. :/
Jul 04, 2007 Scuba Steve 9.0 link
That's really cool, Ray. What's with the weird constant though?

Edit: All I get is 256 megabytes for 268435456 bytes and 32 megabytes for bits.
Jul 05, 2007 raybondo link
MSKanaka: how did you 'check'?

Scuba: It's a bitfield value:
keyboard = 0x10000000
mouse = 0x20000000
joysticks = 0x40000000
Jul 05, 2007 Scuba Steve 9.0 link
We don't have access to RegisterUserCommand() anymore Ray, unless I'm dumb and can't find it. I already know how to use it if we did :/
Jul 06, 2007 raybondo link
Scuba: Yeah, I know, that's why I was asking MSKanaka how he was using it.
This next update tonight will make that function available again.
It will work like this:

RegisterUserCommand(commandname, callback, data)

when commandname is executed, it calls callback with data as the argument. so, something like this:
if commandname then
callback(data)
end

You can unregister the command with UnregisterUserCommand(commandname) or
RegisterUserCommand(commandname, nil, nil)
Jul 06, 2007 raybondo link
Also, this is going to be new in this release:

VO will auto-load all addons in an 'addons' directory.
Place a lua file named 'main.lua' in a subdirectory in the addons directory and it will auto-load on startup and get reloaded when you ReloadInterface().

Therefore you can make addons/radar/main.lua so you don't need to manually dofile(...) on it.
Jul 06, 2007 Scuba Steve 9.0 link
Sweeet. That rocks, Ray.

Edit: Also, kanaka's version of "broke" means "I can't access it" in most lua function situations.
Jul 06, 2007 roguelazer link
Somebody should make a VOWiki page on the LUA subsystem, and on the available LUA modules (like MakeFriends).
Jul 06, 2007 mr_spuck link
Jul 06, 2007 MSKanaka link
yeah, as scuba said, if it's not accessible, I consider it "broke" as far as general community use goes. Sorry for the vagueness.

EDIT: more specifically, if I know the syntax, use the proper syntax, and still get a lua error, then I really consider it broken. ;)
Jul 07, 2007 Aleksey link
Presets and Tab completion don't work for me

I can create preset, but loading that preset doesn't change any option. Pressing Tab when entering a nickname doesn't do anything
Jul 07, 2007 Scuba Steve 9.0 link
Edit: The new version probably broke things. I'll fix it later today.
Jul 07, 2007 slime73 link
I got the new version working, but the 'secret feature' gives me lua errors sometimes (it has since before the update).
Jul 07, 2007 raybondo link
declare() doesn't work like that, currently. I will make it work that way for the next update, but for now you declare("varname")
and then you have to set varname={} or whatever you want to set it to.
The next update will set the variable to the second parameter of declare.
Jul 07, 2007 slime74 link
Yeah, I had to change it to that.
Jul 08, 2007 Scuba Steve 9.0 link
The secret feature is less secret, and more I don't have time to implement it properly right now, so it's just thrown in there. Email me what lua errors you get so I can fix them though.
Jul 08, 2007 slime73 link
What's your email address? :P
Jul 08, 2007 Scuba Steve 9.0 link
Check the first post lawl.

Edit: You could also be inconsiderate and post the lua errors in this thread, I don't care.

Edit2: If you're referring to the error "attempt to index field `?'(a nil value)", then it should be fixed in version 1.4.3
Jul 08, 2007 Aleksey link
I still have Lua error when loading 1.4.3:

sent addons/MakeFriends/main.lua:3: attempt to index field `_G' (a nil value)
stack traceback:
addons/MakeFriends/main.lua:3: in function `f'
vo/vo.lua:272: in function `sb'
vo/vo.lua:383: in main chunk
(repeated several times)

Also I found this in the errors.log:
cannot read addons/MakeFriends/vo/if_hud.lua: No such file or directory
e
Jul 08, 2007 Aleksey link
Looks like Scuba started to edit 1.4.2 to reflect API changes, but stopped in the middle of process, commented out everything he did, and released the result as 1.4.3. Example:

--Depending on VO version, uncomment a line below
iup._G.ufuncs = {}
--declare("ufuncs", {})

Oh, and startup file is still called start.lua, while it should be main.lua

Unfortunately my knowledge in Lua is less than basic, so I can't fix all that mess (trying to learn Lua by reading this forum and looking at code of Scuba, firsm and genka is particularly a bad idea, I should read the fine Lua manual first >_>)