Internet and Mobile: Connecting to the internet
netuttki hat diese Seite bearbeitet vor 2 Jahren

Going over komp.qsrc I found a lot of if A and B and C and D and .... checks for cam show, for searching porn and some other things. There is also the question of what connection Sveta can use in a friends house or a library - there is already an internet and internet_free differentiation in the code, to solve the temporary internet hours getting stuck issue.

To make life simpler - I hope - I added a new variable that aims to replace a lot of those long checks and to cut down the whole decision about whether Sveta connects with the local internet, or mobile, or whatever she has.

I have added the variable access which is something that the location has to set up before calling gt 'komp', 'start'.

Right now access looks like this:

$access['subscription'] : string - this is where we set whether Sveta is using the Library free internet, or her mobile phone or the home internet.
access['metered'] : integer - this is to make it easier the check to see if the internet time needs to be lowered.
Not an absolute necessiry, could use

if subscription[$access['subscription']+'type'] = 2: subscription[$access['subscription'] -= minut`

but

if access['metered'] = 1: ....` is easier.


access['noporn'] : integer - if the value is 1, Sveta can't search for porn. This to replace, for example, a check like this:

if $loc ! 'anushapt' and $loc ! 'albinahome' and $loc ! 'pav_library': act 'Search for porn (0:10)':gt 'komp', 'porno'

becomes this:

if access['noporn'] = 0: act 'Search for porn (0:10)':gt 'komp', 'porno'

$access['noporn-text'] : string - this one holds the specific message that we want to display if access['noporn'] = 1

Using these two together can simplify things:

...
elseif locat['Anya_inroom'] = 1 and sisboytrio = 0 and $loc = 'bedrPar':
   '<center><img <<$set_imgh>> src="images/pc/items/accessories/computer/komp.jpg"></center>'
   'You shouldn''t watch porn with your sister in the room, she would notice for sure!'

   act 'Leave this website':gt 'komp', 'brows'
elseif $loc = 'artemhome':
   '<center><img <<$set_imgh>> src="images/pc/items/accessories/computer/komp.jpg"></center>'
   'You shouldn''t watch porn on Artem''s computer!'
else
...

can be changed to this:

...
elseif access['noporn'] = 1:
		'<center><img <<$set_imgh>> src="images/pc/items/accessories/computer/komp.jpg"></center>'
		'<<$access[''noporn-message'']>>'

		act 'Leave this website':gt 'komp', 'brows'
else
...

access['nocamshow'] : integer - if the value is 1, Sveta can't do a camshow
$access['nocamshow-text'] : string - The custom message we want to display if access['nocamshow'] = 1


It makes the call gt 'komp', 'start' a bit more involved as the code below shows:

!! Computer and internet use.
    if komp = 1:
        if locat['Anya_inroom'] = 1:
            if sisboytrio = 0: access['noporn'] = 1
            access['nocamshow'] = 1
            $access['noporn-message'] = 'You shouldn''t watch porn with your sister in the room, she would notice for sure!'
            $access['nocamshow-message'] ='You can''t do any webcam activities with your sister in the room!'
        end
        !! This will always be $home_name UNLESS someone adds a few scenarios where mom locks the internet from Sveta.
        if subscription[$home_name] = 1:
            $access['subscription'] = $home_name
        elseif $subscription['mobile'] = 1:
            $access['subscription'] = 'mobile'
        elseif $subscription['metered_mobile'] = 1:
            $access['subscription'] = 'metered_mobile'
        end
        if subscription[$access['subscription']+'-type'] = 2: access['metered'] = 1

        'Your <a href="exec: gt ''Komp'',''start''">laptop</a> is on your desk.'
    end

However, with a bit of refactoring we can get here:

if komp = 1:
    gs 'internet_mobile', 'set_access'
    if locat['Anya_inroom'] = 1:
        if sisboytrio = 0: noporn = 1
        nocamshow = 1
        $access['noporn-message'] = 'You shouldn''t watch porn with your sister in the room, she would notice for sure!'
        $access['nocamshow-message'] ='You can''t do any webcam activities with your sister in the room!'
    end
    'Your <a href="exec: gt ''Komp'',''start''">laptop</a> is on your desk.'
end
.......

if $ARGS[0] = 'set_access':
    if $ARGS[1] = 'free':
        $access['subscription'] = 'free'
    elseif subscription[$home_name] = 1:
        $access['subscription'] = $home_name
    elseif $subscription['mobile'] = 1:
        $access['subscription'] = 'mobile'
    elseif $subscription['metered_mobile'] = 1:
        $access['subscription'] = 'metered_mobile'
    end
    if subscription[$access['subscription']+'-type'] = 2: access['metered'] = 1
end

The advantage is that komp doesn't have to care about locations, which means that if we add a komputer to Lariska's or Natasha's house, and we decide that Sveta can't search for porn there, there is no need to add another location to the check in komp, so

if $loc ! 'anushapt' and $loc ! 'albinahome' and $loc ! 'pav_library': act 'Search for porn (0:10)':gt 'komp', 'porno'

needs to be changed to

if $loc ! 'anushapt' and $loc ! 'albinahome' and $loc ! 'pav_library' and $loc ! 'lariskahome' and $loc ! 'natashahome': act 'Search for porn (0:10)':gt 'komp', 'porno'

Looking at the old code, this issue already came up: in the Pavlovsk library, Anushka's apartment and Albina's home, the 'Search for porn' option never shows up because of this check, but for Artem's home the checks happens in the 'porno': code itself, so it's inconsistent - and annoying, player clicks on 'Search for porn' only to get a new screen telling him he can't do that.

With the change, no matter how many new homes are added, all they have to do is to set access['noporn'] = 1 and nothing else is need.

Also, as the example above shows, these limitations can be changed easily based on different criteria, for example if we decide that Sveta can't search for porn in Anushka's apartment normally, and set access['noporn'] = 1 but when they watch porn together three times we allow it, because relationship improvement and all and we can just code

if anushka_porn_together < 3: access['noporn'] = 1

And it will always be 0 after anushka_porn_together value reaches 3. It gives more flexibility.

Using it all in the library:

'Between the bookshelves are some tables which can be used for studying. Some of them have <a href="exec: gs ''internet_mobile'', ''set_access'', ''free'', ''noporn'',''nocamshow''  & gt ''Komp'',''start''">computers</a> for public use.'

An important thing to know that when the computer is shut down it goes to 'komp', 'fin' and executes killvar 'access' so it won't be available after that.