Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'a' needed when checking what entity it is. #10

Open
Mirreski opened this issue Jun 5, 2015 · 6 comments
Open

'a' needed when checking what entity it is. #10

Mirreski opened this issue Jun 5, 2015 · 6 comments

Comments

@Mirreski
Copy link
Owner

Mirreski commented Jun 5, 2015

Example: http://pastebin.com/Ppw0QqLB

The check doesn't work properly without the 'a'.

@Mirreski
Copy link
Owner Author

Hard to fix actually.

When writing "if loop-entity is skeleton", Skript read that as "if loop-entity is the skeleton". Skript doesn't know who "the skeleton" is and it doesn't find the needed comparator because of that and fails to work. Therefore the "a" is needed before the "skeleton" to clarify it as a type not an object.

I am not sure how to fix this at all.

@Mirreski Mirreski changed the title 'a' needed when checking what loop-entity it is. 'a' needed when checking what entity it is. Jun 14, 2015
@Mirreski
Copy link
Owner Author

The expression "[the] [event(-| )]entity/skeleton/player...." and so on, is the expression Skript reads from just "skeleton".

By making "event" required it would probably fix this problem but it would break like every script in the community, so that doesn't seem like a option.

@Mirreski Mirreski assigned Mirreski and unassigned Mirreski Jun 15, 2015
@Mirreski
Copy link
Owner Author

Perhaps fixed without any problems. But it is possible for another issue/bug to appear because of my fix.

Used the same "hack" I got from Njol's code in Issue #9

Needs more testers.

@Mirreski
Copy link
Owner Author

Seems to add another issue/bug. A rather big one for current scripts.

Example code which doesn't work:

command /test:
    trigger:
        set {_player} to player
        message "Location of player: %location of {_player}%"

Example code which works:

command /test:
    trigger:
        set {_player} to event-player
        message "Location of player: %location of {_player}%"

Basicly it's going the other way now. Now you have to prefix it with "event-" for it to work. This would break like every script. So I don't think this fix will work. I have even started to doubt that it is possible to fix this issue without making "event-" or "the" mandatory.

set {_player} to player sets the variable to the TYPE Player not the actual player entity.

This solution seems like a nono. So it will not be added unless I fix this new bug.

@Mirreski
Copy link
Owner Author

I found a new fix(could be called quickfix or a little trick) which works perfectly. Passed all my tests. Still can't guaruantee it's bugfree but it's unlikely to give birth to a new bug since the only code change is to the Compare condition (if entity is skeleton for example).

@Mirreski Mirreski changed the title 'a' needed when checking what entity it is. 'a' needed when checking what entity it is. [V7] Jun 15, 2015
@Mirreski Mirreski self-assigned this Jun 15, 2015
@Mirreski Mirreski reopened this Jun 15, 2015
@Mirreski
Copy link
Owner Author

Previous fix had a problem. It was a miss in my code so I have fixed it. But still there's some "issues" with this fix:

if loop-entity is player: This and similar ones gets read a "if loop-entity is a player" which would probably break a lot of scripts.

I made a quick check for this so my "quick" fix doesn't include the "player" so:
if loop-entity is player:
Will work normally and check "if loop-entity is the player"/"if loop-entity is event-player".

This means in other events such as this(Check the broadcasts to see what I mean):

on spawn of zombie:
    wait 1 tick
    loop all entities:
        if loop-entity is a zombie:
            broadcast "This loop-entity is a zombie"
        if loop-entity is zombie:
            broadcast "This loop-entity is a zombie"
        if loop-entity is event-zombie:
            broadcast "This loop-entity is the zombie that got spawned!"

In the older version(2.1.2, 2.2 and my older versions) this works like:

on spawn of zombie:
    wait 1 tick
    loop all entities:
        if loop-entity is a zombie:
            broadcast "This loop-entity is a zombie"
        if loop-entity is zombie:
            broadcast "This loop-entity is the zombie that got spawned!"
        if loop-entity is event-zombie:
            broadcast "This loop-entity is the zombie that got spawned!"

This seems to be the best result of the fixes I have tried for this.

Don't worry I stated high up in this comment that code involving comparing with players like:

command /doiexist:
    trigger:
        loop all players:
            if loop-player is player:
                message "Loop-player is the player who called the command."
                stop

Will work just fine!

Either this "fix" or I will attempt to find another one or scrap this bug.

@Mirreski Mirreski changed the title 'a' needed when checking what entity it is. [V7] 'a' needed when checking what entity it is. Jun 17, 2015
@Mirreski Mirreski removed their assignment Jun 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant