• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

RevScripts Problem with position in Revscripts (Action)

donabimbo

Member
Joined
May 1, 2023
Messages
27
Reaction score
9
GitHub
donabimbo
Greetings, I noticed something that I don't know that I would have to add to make it work.

I have a Revscripts type Movements, which I can place position on, without the need to use id, aid or uid.

Lua:
local wayOut = MoveEvent()

function wayOut.onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return false
    end

    return true
end

wayOut:position(Position(33082, 31532, 7),Position(33082, 31533, 7))
wayOut:register()

As you can see in this script, I put wayOutposition.
But instead if I do it with an Action, it throws me an error.
image_2023-06-01_232852850.png


Code:
local wayOut = Action()

function wayOut.onUse(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return false
    end

    return true
end

wayOut:position(Position(33082, 31532, 7),Position(33082, 31533, 7))
wayOut:register()
 
Greetings, I noticed something that I don't know that I would have to add to make it work.

I have a Revscripts type Movements, which I can place position on, without the need to use id, aid or uid.

Lua:
local wayOut = MoveEvent()

function wayOut.onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return false
    end

    return true
end

wayOut:position(Position(33082, 31532, 7),Position(33082, 31533, 7))
wayOut:register()

As you can see in this script, I put wayOutposition.
But instead if I do it with an Action, it throws me an error.
View attachment 75911


Code:
local wayOut = Action()

function wayOut.onUse(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return false
    end

    return true
end

wayOut:position(Position(33082, 31532, 7),Position(33082, 31533, 7))
wayOut:register()
Because one is to use, the other is to stepin/out, you cant use a position but can step in this position

If u need to use an item in one position, just make sure to check player position to match with the position when using an item
 
First time I see such way of registering an action, from what I've found it's Canary thing:

C++:
registerClass(L, "Action", "", ActionFunctions::luaCreateAction);
registerMethod(L, "Action", "position", ActionFunctions::luaActionPosition);

Not implemented in TFS:
 
First time I see such way of registering an action, from what I've found it's Canary thing:

C++:
registerClass(L, "Action", "", ActionFunctions::luaCreateAction);
registerMethod(L, "Action", "position", ActionFunctions::luaActionPosition);

Not implemented in TFS:
Ooooh, I tried to add it with the TFS functions and the attempt failed, I hope that in the future they will introduce this new method.
Post automatically merged:

Because one is to use, the other is to stepin/out, you cant use a position but can step in this position

If u need to use an item in one position, just make sure to check player position to match with the position when using an item
Yes, but the thing is that it throws an error just by turning on the server or doing reload. It's not when I click on it.
 
Revscripts are self-registrable, action callbacks are registered on script load time as it call's register on action object.
That's why it throws on start/reload. There's no such method as position on action that's why you get such errors.
 
Last edited:
I inserted a chat message that is displayed to the player when he enters the position defined by the movement event. I also removed the wayOut:position() call that was causing problems and set the position directly in the wayOut.onStepIn function.

Lua:
local wayOut = MoveEvent()

function wayOut.onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return false
    end

    
    player:say("You have entered the custom position!", TALKTYPE_MONSTER_SAY)

    return true
end


wayOut:position(Position(33082, 31532, 7), Position(33082, 31533, 7))


wayOut:register()
 
Back
Top