05-11-2010 02:11 AM
Hello.. I'm new at trying scripting.. and i was trying to create a currency hud for my RP sim. We need role play money to help develop a trading system and currency to the current role play going around the city. So i was wondering if anyone could help me create something or if you know a tutorial that could help create it.. i want a hud that is interactive and that it will allow the currency to be given, stolen and even be put back in into the hud. I also want a trading system that can work with the hud.. the only thing i have seem similar to this, is the gorean meter... but i dont want a RPG meter.. we already using one for our current RP. If you can help, please feel free to reply to this discussion.. or contact me in world..
05-12-2010 12:01 PM
I am also interested in such an application. For an educational forensic ICT game at Within Ten Years, where students play and detect criminal networks, we also need a kind of money (or credits) system in a HUD. So any idea about scripting this will be very welcome.
05-12-2010 01:10 PM
Nice, is good to know i'm not the only person looking for a money hud.. inworld i have meet few people who claim to have something like this going, but they have a health/stamina meter attach to it, and is not what i want. I want to create some currency in my RP place, and only way i see this happening is by having some sort of money and trading that can interact with each other.. I was looking at the scripting library and found out a little more about LLdialog, bit i cant seems to find a counter, and something to keep track of each transaction. I hope someone that knows how to do this, replies to this forum..
05-13-2010 11:09 PM
All you need is just a global variable in the HUD to keep track of the money and a communication system between HUDs.
How I would do it:
Start with this:
Then the important part is picking some negative channel that is kept secret;
integer negativeChannel = -696969;
Then of course you listen to that channel, you can even filter for the hud name:
llListen(negativeChannel, "HUD name", NULL_KEY, "");
Now the elaborate part is to create a command oriented communication system so the HUDs can talk to each other.
This can done with putting different information in a string separated by a keyword.
For example if I wanted to give someone money, it would look like this:
string separator = "im_a_separator";
GiveMoney(float amount, key targetHud)
myMoney -= amount;
llSay(negativeChannel, "give money to" + separator + (string)targetHud + separator + (string)amount);
llOwnerSay("you have just given " + (string)amount " money);
Then on the other end you would just listen and parse:
listen(integer channel, string name, key id, string msg)
list parsed = llParseString2List(msg, , );
key target = llList2Key(parsed, 1);
if(target == llGetOwner())
string command = llList2String(parsed, 0);
if(command == "give money to")
myMoney += amount;
llOwnerSay("you just received " + (string)amount + " money, yay!");
Might seem complicated if you haven't done something similar but you should be able to work it out from these examples.
05-14-2010 12:14 AM
Ohh.. awesome, i'm going to play around it the.. thank you so much.. This will count and keep track of invisible hud only money? I manage to work something but it only works by counting prims, and is definatelly annoying.. any suggestions on how to make the new communicate with each other but that it doesnt give aways prims or other stuff?
05-14-2010 09:24 PM
I don't understand why you count prims. If you set a global variable to keep track of your HUD money, then you just manipulate that information around. As long as you don't allow the script to be reset, it will be persistant. Then, because your money is a global variable, no one can ever find that out unless you tell them.
05-16-2010 02:40 PM
because passing prims is more secure than just passing messages... the other alternative is on demand auth, with multiple users... which can be a pain
05-16-2010 06:03 PM
How secure does a RPG Currency HUD need to be? I think it's pretty hard enough to find that secret channel out of all possibilities, you can always use extra measures for security when passing messages. I bet it's more probable that the asset server will have a bad trip from time to time then the HUD is not gonna be happy. Plus for trading I believe it's mostly one on one at a time.
05-16-2010 07:30 PM
actually it's not hard at all to find a channel, takes a few minutes tops if you know what you are doing. encryption won't help becuase it's subject to replay attacks, and auth takes a lot of code and script time. objects are simple... plus with things the way they are a database problem is just as likely to bork your script and lose the count as an object transfer failure.... you lose one object (or even a few), no biggie, you lose the whole count, that's bad.
unfortunately people will go a long way to cheat pretty much any system
05-16-2010 09:41 PM
Ohh.. Interesting.. i didn't think about the cheating part.. but i just want something simple.. like a pocket, that keeps RPG money, and can be interactive.. meaning some can come over, and steal, give you money or you can give it out, does it sound complicated? As to a trading system, that for sure i have no idea on how to start it..
I remember the Gorean Meter seems to be a very simple hud, and it keeps a RPG currency and trading system to it. The tradying part doesnt seem to me so easy, because those factories create the RP item, every other day.. or every two days depending on the item.. We are using combat system, one of the reason we dont used the Gorean Meter.. and why we want an independent hud. We want the combat and the currency to be different from one another.. any suggestions on how to get the trade part going?