DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • March 22, 2019, 05:14:18 PM
Home Forums News Downloads Login Register Advanced Search
* *
DragonPrime Menu
Login
 
 
Resource Pages
Search

  Show Posts
Pages: [1] 2 3 ... 33
1  Modules, Themes and other customizations for your game / Themes / Re: Template: Hypertext - A basic foundation for building more modern templates on: January 22, 2019, 10:36:33 PM
OK, so I downloaded it and uploaded it.  Guess I need to try looking t the code, I never have been good at templates.
2  Game Administration, Installation and Configuration / The Idea Place / Re: suggestion to create a Wonka-challenge, based on the Medallion Contest? on: January 16, 2019, 11:55:56 PM
Well in theory, just about anything is possible, you just have to know how to get there.

In answer to your initial question, yes it is possible to have more than one contest running at a time.  The better question is...how many do you want going at the same time?  Don't want to overwhelm players (yeah, I should talk, right??)

BUT...all that aside...

So...to start with, you need a player to buy access in - so you need a lace for them to do that, a village shop or a forest event...I think village shop is better.

SO...now you set a player pref to YES (bought newspaper)...now they are either able to buy the one chocolate bar per day, or find one in, say a village or forest event.

When they find one, you have an event that finds it...and checks if there is a golden ticket.

So now you set a pref for YES found a bar today.  and either YES or NO if they got a golden ticket.

If they got a ticket, then you increment a module SETTING.  When this reaches five, nobody will be able to buy in or find/buy bars.

NOW...once you have all five, then the village shop opens to the five players who have one (check for the player pref)

And then you do whatever you want inside that village shop.

So that is the basics of how you would do it...so if anyone wants to, that's a head start.
3  Coding Support / Coding Support Desk / Re: How To Reset The Prefs Of ALL Players on: January 14, 2019, 01:21:15 AM
I highly suggest copying your database + testing such things there =) if you don't have a test server.

On another note: Yes, your query looks sound, but you could drop "AND setting", if you want to reset ALL prefs. Else you just reset the setting "blah_blah_blah".

I have a test server.  I just wanted to know about this because of the setting thing.  The only value I want to reset is how many turns all players worked...that way they are not paid for turns helped on previous disasters again.
4  Coding Support / Coding Support Desk / Re: Tables Question on: January 11, 2019, 02:43:23 AM
And that is different based on the screen size of the end user, isn't it?

Sometimes. If you have a wide table and narrow view (e.g. mobile phone), then there's not overly much you can do.

But how to make the next table show up just to the right of the first one...instead of underneath?
Whatever table you're wanting align, just set the "style" attribute to "float:left" in the table'a HTML itself.

I had already said.

The other way, though not recommended, is to create a "wrapper" table and cells, and put the tables in those cells. So:

Table
Row 1
Cell 1 - Includes first table
Cell 2 - Includes second table
End row
End table

Actually, I have put a table inside of a table before.  Not sure why I did not think of it.
Just something I am tossing around as part of a new module I am trying to work on.  I thought in this case, what i am working on....a side-by-side table would be more user-friendly.  It''s not normally a format I like, either.
5  Coding Support / Coding Support Desk / Re: How To Get One Word Within A String Variable? on: January 11, 2019, 02:40:31 AM
I tried an unserialize on this.  It still came back wrong, and this time it returned an array.
So I went back to in_array - still did not work.

So, I imploded the value of the fetched variable as a comma delineated string...and all I got was a bunch of 1's separated by commas.

I am truly flummoxed here.  Nothing is getting me to where I want to be.

I looked in the case: biostat of Petra.
But I don't understand quite what is happening there.  I want to compare each thing one at a time.
I need to compare ONE AT A TIME....each possible tattoo, do they have it or not?  And then do or do not do an action accordingly.

I am not sure how I get there.

Go to http://phptester.net/ and put this in:

Code:
<?php
$s 
'a:9:{s:7:"mermaid";i:1;s:7:"rainbow";i:1;s:10:"red_dragon";i:1;s:13:"yellow_dragon";i:1;s:11:"blue_dragon";i:1;s:12:"white_dragon";i:1;s:12:"black_dragon";i:1;s:11:"gold_dragon";i:1;s:12:"green_dragon";i:1;}';
$t unserialize($s);
print 
"<pre>";
print_r($t);
print 
"<pre>";

It works. In your code, you might need to use stripslashes() first, when you get the pref.

Overthinking for what I needed to do, but thanks.  I am bookmarking that phptester page!!
6  Coding Support / Coding Support Desk / Re: How To Get One Word Within A String Variable? on: January 11, 2019, 02:38:11 AM
Thanks, Aeolus!

The = versus == thing did it.  Now I feel dumb, lol, I should have known better.

This was all I needed, the rest of it was overthinking the thing.  I just needed a check and a yes/no answer to feed an "if"

But good info to have for future reference, should I need it.  This is how I learn.  But I did look all this stuff up and read n it.
7  Coding Support / Coding Support Desk / Re: How To Get One Word Within A String Variable? on: January 11, 2019, 02:20:38 AM
I tried an unserialize on this.  It still came back wrong, and this time it returned an array.
So I went back to in_array - still did not work.

So, I imploded the value of the fetched variable as a comma delineated string...and all I got was a bunch of 1's separated by commas.

I am truly flummoxed here.  Nothing is getting me to where I want to be.

I looked in the case: biostat of Petra.
But I don't understand quite what is happening there.  I want to compare each thing one at a time.
I need to compare ONE AT A TIME....each possible tattoo, do they have it or not?  And then do or do not do an action accordingly.

I am not sure how I get there.
8  Coding Support / Coding Support Desk / Re: How To Get One Word Within A String Variable? on: January 11, 2019, 01:54:47 AM
Just for interest...I had it print out the value of $tat and this is what came back

a:9:{s:7:"mermaid";i:1;s:7:"rainbow";i:1;s:10:"red_dragon";i:1;s:13:"yellow_dragon";i:1;s:11:"blue_dragon";i:1;s:12:"white_dragon";i:1;s:12:"black_dragon";i:1;s:11:"gold_dragon";i:1;s:12:"green_dragon";i:1;}

This almost looks like allprefs to me.  But it isn't.

Still, though, should I actually do an unserialize on this?

But why would the strpos function find something that was not there?

How would I get where I am trying to go?
9  Coding Support / Coding Support Desk / How To Get One Word Within A String Variable? on: January 11, 2019, 01:49:03 AM
OKO, I am stuck, what I am trying to do does not seem to be working right...and I did my research.  So can someone tell me what I am doing wrong?

What I am trying to do is to get the list of tattoos a person has with Petra's...and check if they have each tattoo.  This is not happening in Petra itself, but another module which is grabbing the pref "tatname" from the Petra module.  This is a string variable.  I had thought it an array at first, but when I used in_array function, I got a call stack informing me it was expecting an array and got a string.

So, I tried the strpos function.  My problem right now is that it always returns a true, even when it is in fact false (the requested thing is NOT in the string.

This is my coding at the moment
Code:
$rdtat = "no";
$tat = get_module_pref ("tatname","petra");
if (strpos($tat, "Magpie") !== false){
$rdtat = "yes";
} else {
$rdtat = "no";
}
if ($rdtat = "yes") {
output ("red");
} else {
output ("green");
}
So...what I am TRYING to do here...
I set $rdtat as "no" - so that it would always default to "no" when running
I grabbed the string variable which should contain the names of all the tats the player has. (PREF TATNAME, PETRA)

I am trying to compare the word "Magpie" against the elements of the string variable (this should come back as false in this case, I did that deliberately)

But it comes back as true, apparently, because the variable $rdtat - which I specifically set as "no" initially....is getting set to "yes"
because my output line says red instead of green  (I used red and green as samples, figuring green means go, I got it right, and red mean stop, I did not get it right)

Bottom line....what am I not doing right here?  It is finding something that is not in the string variable.

Kinda figured on...if I had got this far and got it right, I would then have changed "Magpie" to something it would find to test if that worked.  But I did not get that far.
10  Coding Support / Coding Support Desk / Re: Tables Question on: January 10, 2019, 11:15:35 PM
The tables (including borders and margin) must not exceed 100% width of the parent element, else they will still show under each other even while floating.

And that is different based on the screen size of the end user, isn't it?
11  Coding Support / Coding Support Desk / Re: Tables Question on: January 10, 2019, 06:55:31 AM
OK, I noticed the function cssfloat.  Because "float" is reserved in Java.  You can use this directly within a module, then?  Was not sure LOTGD would recognize the function as it is not defined within LOTGD.

"cssFloat" is the Javascript property, but that's not necessary here at all. Whatever table you're wanting align, just set the "style" attribute to "float:left" in the table'a HTML itself.

But how to make the next table show up just to the right of the first one...instead of underneath?
12  Coding Support / Coding Support Desk / Re: Tables Question on: January 09, 2019, 06:29:08 PM
So it would need to be done in the style sheets of the templates themselves, and not the module?

Nope. Not everything CSS has to be done in the style sheets of templates. You can use CSS inline in HTML's "style" attribute.
OK, I noticed the function cssfloat.  Because "float" is reserved in Java.  You can use this directly within a module, then?  Was not sure LOTGD would recognize the function as it is not defined within LOTGD.
13  Coding Support / Coding Support Desk / Re: Tables Question on: January 09, 2019, 03:08:59 AM
Look up CSS's "float" property.

So it would need to be done in the style sheets of the templates themselves, and not the module?
14  Coding Support / Coding Support Desk / Tables Question on: January 09, 2019, 01:53:16 AM
Is there a way to make two tables show up side by side, instead on one under the other?
15  Coding Support / Coding Support Desk / How To Reset The Prefs Of ALL Players on: January 07, 2019, 06:10:19 PM
OK, so there is a module out there that creates Disasters in villages.

There's even notes in the coding that says it is to reset the prefs, but it does not seem to reset them.

The problem is...after a Disaster is cleared, everyone who helped, is paid gold per turn they helped.  But the prefs don't reset...so you end up being paid for every turn you helped on every disaster.

I need coding that, when a Disaster is cleared...it will pay everyone...and THEN...reset the prefs on the module for ALL players - so that each time you are paid ONLY for the turns you worked on the current Disaster...and not on every Disaster you ever worked.

I could easily reset the prefs of the player that ends the Disasyer, but how to reset them for ALL players?

In hunting around some I mighta found something...I found something generic which I would need to change...

db_query("DELETE FROM ".db_prefix("module_userprefs")." WHERE modulename = 'YOUR_MODULE' AND setting = 'blah_blah_blah'");

I'd replace YOUR_MODULE with the name of the module
and
Setting with the actual name of the setting...right?

Just want to know for sure before I do this and screw something up.
Pages: [1] 2 3 ... 33

*
DragonPrime Notices
Play LoGD on Dragonprime

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
17 Guests, 1 User
Aeolus
Home Forums News Downloads Login Register Advanced Search