• 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!

[Movements] onStepIn - Lua script not triggered (tfs 1.0)

monodark

New Member
Joined
Dec 30, 2007
Messages
33
Reaction score
4
Location
Netherlands
Hi folks,

I got this strange thing, I created a few tiles in my map with action ID 25252, but the script is not triggered when I step on the tile.

Added this to my movements.xml:
Code:
<movement event="StepIn" actionid="25252" script="viptile.lua"/>

This is the lua file:
Code:
function onStepIn(cid, item, position, fromPosition)
   local player = Player(cid)
   if not player then
      return
   end
   if getPlayerVipDays(cid) == 0 then
          doTeleportThing(cid, fromPosition, FALSE)
          player:sendTextMessage(MESSAGE_INFO_DESCR, "You are not allowed in the VIP area.")
   else
          player:sendTextMessage(MESSAGE_INFO_DESCR, "You entered the VIP area.")
   end
   return true
end

This function is custom (and tested):
Code:
 getPlayerVipDays(cid)

When I look through the source code of TFS 1.0 I can't find anything wrong either.

All the help I can get is appreciated!
Thanks in advance.
 
Last edited:
I would check to ensure the server was restarted after the scripts were implemented.
Beyond that, check the server log for any error's.
Even better, have messages sent to console for each trigger line, to ensure where the code is breaking.

If still having trouble post back.
 
Seems like the error is on your xml file:
<movementevent="StepIn"actionid="25252"script="viptile.lua"/>

About your script, AFAIK you need to delete this as well:
local player = Player(cid);
player:sendTextMessage(MESSAGE_INFO_DESCR, "You are not allowed in the VIP area.");
player:sendTextMessage(MESSAGE_INFO_DESCR, "You entered the VIP area.");
 
Hi Xikini, thanks for your reply.
Server is not logging anything, even not when I force a message at the beginning of the script.
The script is reloaded for sure as well.

Hi Colors, thank you as well!
I see the XML lacks spaces here, but they are there, besides that, movement event is correct (somehow all spaces in that line disappeared).
The ; are the result of an autoreflex as C#/C++/Java programmer, however this does not affect LUA functionalities in any way.

Your suggestions are highly appreciated.
 
You can add print under function onStepIn to see if the script is loaded when you step on the tile.
Code:
print("Script load test.")
How did you added it in the map?
 
You can add print under function onStepIn to see if the script is loaded when you step on the tile.
Code:
print("Script load test.")
How did you added it in the map?

Hi Limos,

Thanks for the suggestion.

Those are now the first two lines of my script (tested this already ;) but just to be sure)
Code:
function onStepIn(cid, item, position, fromPosition)
      print("VIP tile script called")

I did add it to the map using an action id, using RME:
08:35 You see a drawbridge.
ItemID: [1284], ActionID: [25252].
Position: [X: 32350] [Y: 32222] [Z: 8].

I'll debug the script loading and triggering in the c++ code and see if everything is working properly there. Might I find the problem, then I'll report back here.

Best regards,
 
Back
Top