Page 1 of 2

I am not sure why this doesn't work

Posted: Tue Jan 15, 2019 7:58 am
by OGslinkyT
if table.contains(wotmudmapper.dlineIDnorth[1],"north") then
wotmudmapper.NorthNorthID = 1
else
wotmudmapper.NorthNorthID = 0
end

I have been struggling trying to figure out how to do this.
lua table.contains(wotmudmapper.dlineIDnorth[1],"north") in the comand line returns true
if I type lua wotmudmapper.NorthNorthID = 1 this will set my variable

what am I missing why does this not work as an if/then statement?

Re: I am not sure why this doesn't work

Posted: Tue Jan 15, 2019 8:51 am
by valaria
may I ask what you try to accomplish with these functions you intend to use for?

Re: I am not sure why this doesn't work

Posted: Tue Jan 15, 2019 9:31 am
by OGslinkyT
I don't know if other muds work this way but on the mud I play (wot mud) when you flee away from a fight there is an opportunity to stack commands.
This means when entering a direction after fleeing causes you to move 2 rooms or "double line". Of course this only works if you enter the correct direction. I was attempting to make trigger that would show on a hud the double lines of the current room I am in and the percent chance of getting that particular double line.

Re: I am not sure why this doesn't work

Posted: Tue Jan 15, 2019 9:45 am
by valaria
from your code:

Code: Select all

if table.contains(wotmudmapper.dlineIDnorth[1],"north") then 
	wotmudmapper.NorthNorthID = 1	
else
	wotmudmapper.NorthNorthID = 0
end
from my understanding, table.contains will return true or false based on its finding if that table contains that value you are looking for in that table of any number of arrays. then it will set the variable 'wotmudmapper.NorthNorthID = 1' if it does. otherwise it set to it to zero. that how i read it.

can you tell me the step by step in pseudo code of how would you like escape? (i don't know any commands(except directions maybe) over there at wotmud to help you in this case.

my best guess is:

Code: Select all

if table.contains(wotmudmapper.dlineIDnorth[1],"north") then 
	send("north;north")
end
:?: :? :?:

Re: I am not sure why this doesn't work

Posted: Tue Jan 15, 2019 9:47 am
by OGslinkyT
the purpose of this particular piece of code is to gather information for percentages.

my idea was to make all non exits of ajdacent rooms = 0
and all exits = 1

for instance if I am in a room with North and South exits and my the room to my North has exits North, East and South and the room to my South has exits North and South.

for example I would make the variable NorthWest = 0 and the Variable NorthEast = 1
then I could make a code to add all the Dline exits for a particular direction and divide it by the total number of exits in the room I am in. For this to work I need exits that don't exist in adjacent rooms to have a value of 0. That way I could write the code to add all the exits all the time and have this code change them to 1 when appropriate.

In my example it would of course have the number of east d lines be 1 with the number of exits be 2. that would mean I would have a 50% chance to d line east.

I forgot to mention that flee in the mud I play causes you to run in a random direction

Re: I am not sure why this doesn't work

Posted: Tue Jan 15, 2019 9:55 am
by OGslinkyT
For some reason when I trigger that if/then statement above it does not change the variables listed below it. I can use other commands such as send based on a if/then statement but changing or setting a variable does not work and I can't understand why.

Re: I am not sure why this doesn't work

Posted: Wed Jan 16, 2019 6:59 am
by OGslinkyT
I figured it out. I had a previous conflict that was causing this code not to work.

Re: I am not sure why this doesn't work

Posted: Wed Jan 16, 2019 7:04 am
by valaria
:ugeek:

Re: I am not sure why this doesn't work

Posted: Tue Jan 22, 2019 3:14 am
by SlySven
Ah, some one who is getting to grips with dline-ing - that is one of many skills I've yet to come to grips with - which is just one of the reasons why I pretend to be hanging around in the White Tower libraries and never venture outside into even Tar Valon city proper...

a.k.a. Jomin al'Bara - Tower Accepted

Re: I am not sure why this doesn't work

Posted: Wed Jan 30, 2019 3:46 am
by OGslinkyT
Hi Sly. This is puddles on wotmud.

I did finish this code and will post it tomorrow for you to check out (as I am at work right now). I am quite proud of it because it forced me to find solutions and use new tools in coding I hadn't before. I didn't post it on wotmud forums because I don't know enough about coding to figure out why things don't work for other people.

The math that I use to figure out the d line % seems like it could be useful for other applications.