Questions, questions...

General discussion about the Genesis Web Client located at https://www.genesismud.org/play/

Moderator: Eowul

Forum rules
- Use common sense and be respectful towards each other at all times, even when disagreeing.
- Do not reveal sensitive game information. Guild secrets, player seconds are examples of things not allowed.
Yanus
Adventurer
Posts: 95
Joined: 08 Mar 2010 15:58

Re: Questions, questions...

Post by Yanus » 08 Oct 2013 14:40

.
Last edited by Yanus on 31 May 2014 12:44, edited 1 time in total.

Yanus
Adventurer
Posts: 95
Joined: 08 Mar 2010 15:58

Re: Questions, questions...

Post by Yanus » 08 Oct 2013 22:04

.
Last edited by Yanus on 31 May 2014 12:47, edited 1 time in total.

User avatar
Eowul
Wizard
Posts: 106
Joined: 03 Mar 2010 21:55
Location: Middle Earth

Re: Questions, questions...

Post by Eowul » 09 Oct 2013 07:42

Yanus wrote:Why args.length is undefined?
In what scenario?
Caretaker of Arda

Yanus
Adventurer
Posts: 95
Joined: 08 Mar 2010 15:58

Re: Questions, questions...

Post by Yanus » 09 Oct 2013 13:15

.
Last edited by Yanus on 31 May 2014 12:43, edited 1 time in total.

Arcon

Re: Questions, questions...

Post by Arcon » 18 May 2014 09:21

Is there anyway to set up a macro?
I am so used to have 0 as a "h all" macro and I hit it obsessively.

User avatar
Zhar
Wizard
Posts: 782
Joined: 17 Apr 2012 12:09

Re: Questions, questions...

Post by Zhar » 18 May 2014 12:59

Yanus wrote:Alias.
Name: bromba
Type: javascript
Body:

Code: Select all

gwc.output.append(args.length);
gwc.output.append(args[1]);
Input:

Code: Select all

bromba alalala
Output:

Code: Select all

undefined
alalala
args is an object, objects in JS have no length property and that's what's causing it to be undefined. You can iterate through them but you can't invoke array-specific functions on them (like length).

More reading: https://www.inkling.com/read/javascript ... ke-objects
Time is precious. Waste it wisely.

Yanus
Adventurer
Posts: 95
Joined: 08 Mar 2010 15:58

Re: Questions, questions...

Post by Yanus » 18 May 2014 14:43

.
Last edited by Yanus on 31 May 2014 12:48, edited 1 time in total.

User avatar
Zhar
Wizard
Posts: 782
Joined: 17 Apr 2012 12:09

Re: Questions, questions...

Post by Zhar » 18 May 2014 17:07

Yanus wrote: @Zhar
That's the ancient problem.
Your example isn't 100% clear to me, but hopefully some of this helps? If you are actually passing in an argument like args, then its possible in your example that args could be an object, not an array.

Code: Select all

var obj = {};
obj[1] = 'test';
Above would be an example where your obj[1] would return a value but length would not be known.

If you are actually trying to access the arguments of a function, then, the keyword is arguments and it isn't passed into the function, its just kind of there.

What happens if you change the code to:

Code: Select all

gwc.output.append(arguments.length);
?
Time is precious. Waste it wisely.

Yanus
Adventurer
Posts: 95
Joined: 08 Mar 2010 15:58

Re: Questions, questions...

Post by Yanus » 18 May 2014 23:00

.
Last edited by Yanus on 31 May 2014 12:49, edited 1 time in total.

Arcon

Re: Questions, questions...

Post by Arcon » 19 May 2014 08:59

Yanus wrote:@Arcon:

What do you mean by that? Is macro being fired up on pressing the key (without the need to press Enter afterwards)?
I don't think it's possible at the moment.

@Zhar
That's the ancient problem.
Yes. in Zmud I have the 0 on the numpad as h all and I hit it compulsively all the time.

Post Reply
http://tworzymyatmosfere.pl/przescieradla-jedwabne-z-gumka/