Building & Scripting > Scripting Board

A room counter

<< < (2/2)

erwin:
I think Now says he'll put the command in soon.

I also have another question.

Suppose the player has a flag called africanexploredtens4

You would normally call this by %actor.africanexploredtens4%.

However, suppose the player is in room 12345. Using the code


--- Code: ---set num %actor.room.vnum%
eval tens %num.charat(4)%
set tensvar africanexploredtens%tens%

--- End code ---

we will have tensvar to be africanexploredtens4.

However, how would I then modify this flag? The following syntaxes:


--- Code: ---%actor.tensvar%
%actor.%tensvar%%
%actor.%tensvar%
%%actor.tensvar%%
--- End code ---

doesn't work for me, because the system interprets it as a flag called tensvar, instead of africanexploredtens4.

Anyone have any ideas?

Jaros:
not sure what you're after.  if you remote tensvar %actor.id% then %actor.tensvar% will point to 'africanexploredtens4' and %actor.tensvar.charat(20)% will point to 4.  If there was a way of changing character at index you could modify it easily, otherwise you can loop through appending characters onto a new flag, with a modified char at 20.

erwin:
Well, my idea is, suppose you had 10 flags on you, africanexploredtens0, africanexploredtens1, ..., africanexploredtens9.

africanexploredtens4 is currently set at 0011011001

The idea is, once you step into a room (eg, room vnum 12345), we have set tens %num.charat(4)%, and I'm hoping to link this to the flag africanexploredtens4, so we check whether the 5th position is a 0 or 1.

Hence I have set tensvar africanexploredtens%tens%.

What I'm hoping is that %actor.tensvar% (or some sort of variant) will give me the flag 0011011001, so I can check whether the respective position is 0 or 1.

Jaros:
If you're using binary flags why do you need africanexploredtens0...africanexploredtens9?  Why not just use one long flag?

ie. %africa.charat(4*10+5)% instead of %africanexploredtens4.charat(5)%

erwin:
I've been told that a long string is not as efficient because DG doesn't store strings very well.

Not to mention, without a replace character command, looping through a 100 character string isn't very efficient. Neither are doing operations on the string since then the string would be a 100 digit number...

Navigation

[0] Message Index

[*] Previous page

Go to full version