View unanswered posts | View active topics It is currently 17 Jul 2018 23:05

Forum rules


- Use common sense and be respectful towards each other at all times, even when disagreeing.
- Do not reveal sensitive game information. Guild secrets, player seconds are examples of things not allowed.



Reply to topic  [ 29 posts ]  Go to page Previous  1, 2, 3
Math 
Author Message
Rising Hero
User avatar

Joined: 29 Feb 2016 19:51
Posts: 318
Location: Everywhere
Kwevin wrote:
Do you know of any resource I can use to debug line by line? I'm currently using Droidscript.
Nope. I use Notepad. I like making things difficult for myself.
W3 also has a Tryit Editor.. It doesn't tell you what you've done wrong, but it does color the code, making it easier to read.
http://www.w3schools.com/html/tryit.asp?filename=tryhtml_basic

_________________
Chillin
[-_- ]
Click here to become a pupil of my Brute! It's really cool, I swear.


27 May 2017 01:00
Profile WWW
Myth
User avatar

Joined: 09 Mar 2010 20:33
Posts: 1331
Location: UK
OK I got a question cus I'm not that familiar with the client.

Is there a way for a trigger to 'fire' an alias.

Code:
Simple example:
Alias: lc = get all from corpse
Trigger: you killed = lc


I know u can set lc as a game alias and trigger output as send lc.
Want a trigger that resolves lc to get all from corpse in the client before sending it to the mud.


Next step.
A trigger where u can send a bunch of aliases and plain commands.
Code:
Simple example:
Alias: lc = get all from corpse
Trigger: you killed
=
lc
get imbued items from corpse

_________________
http://genesisquests.pbworks.com/
Join up and help each other with Quests :)


27 May 2017 02:02
Profile
Veteran

Joined: 21 Mar 2016 09:17
Posts: 206
That is possible. Anything is possible with code! :D In all seriousness, I unfortunately can't tell you. I'm not experienced with code.

_________________
Alea iacta est. Serius regredi est.


28 May 2017 06:22
Profile
Veteran

Joined: 21 Mar 2016 09:17
Posts: 206
Code:
var copp = 1728;
if copp >= 1728
   var plat = copp/1728;
   var prem = copp - (plat * 1728);
   var gold = prem/144;
   var grem = prem - (gold * 144);
   var silv = grem/12;
   var srem = grem - (silv * 12);
   var copp = srem
(end);
if copp >= 144
   var plat = 0;
   var gold = copp/144;
   var grem = copp - (gold * 144);
   var silv = grem/12;
   var srem = grem - (silv * 12);
   var copp = srem;
(end);
if copp >= 12
   var plat = 0;
   var gold = 0;
   var silv = copp/12;
   var srem = copp - (silver * 12);
   var copp = srem;
(end);
if copp < 12
   gwc.output.color("#FF1493");
   gwc.output.append("But it already is minimized!");
(end);
gwc.output.color("#98AFC7");
gwc.output.append(plat + " platinum.");
gwc.output.color("gold");
gwc.output.append(gold + " gold.");
gwc.output.color("khaki");
gwc.output.append(silv + " silvers.");
gwc.output.color("#B87333");
gwc.output.append(copp + " coppers.");

It won't work for some reason. Anyone know what's wrong with it?

Two other things.
Firstly, I want the initial "copp" var to be a wildcard from the pattern (if possible, and if trigger) or better, something from the command (if possible, and if alias).

Secondly, the way I have it set up, in if statements, I want it to skip the code that goes plats to coppers if it can't go to plats. Or is that a bunch of redundant code?

_________________
Alea iacta est. Serius regredi est.


28 May 2017 06:30
Profile
Rising Hero
User avatar

Joined: 29 Feb 2016 19:51
Posts: 318
Location: Everywhere
Kwevin wrote:
Code:
var copp = 1728;
  if (copp >= 1728) {
    var plat = copp/1728;
    var prem = copp - (plat * 1728);
    var gold = prem/144;
    var grem = prem - (gold * 144);
    var silv = grem/12;
    var srem = grem - (silv * 12);
    var copp = srem
  } else {
      if (copp >= 144) {
        var plat = 0;
        var gold = copp/144;
        var grem = copp - (gold * 144);
        var silv = grem/12;
        var srem = grem - (silv * 12);
        var copp = srem;
     } else {
         if (copp >= 12) {
           var plat = 0;
           var gold = 0;
           var silv = copp/12;
           var srem = copp - (silver * 12);
           var copp = srem;
        } else {
            if (copp < 12) {
              gwc.output.color("#FF1493");
              gwc.output.append("But it already is minimized!");
            }
           }
      }
   }
gwc.output.color("#98AFC7");
gwc.output.append(plat + " platinum.");
gwc.output.color("gold");
gwc.output.append(gold + " gold.");
gwc.output.color("khaki");
gwc.output.append(silv + " silvers.");
gwc.output.color("#B87333");
gwc.output.append(copp + " coppers.");
The "if, else, if" statements should work now..
If I counted the brackets properly..
I'm not sure how to get "copp" to be defined as an input variable..
You may have to edit the global copp manually then run the code with a designated alias.

_________________
Chillin
[-_- ]
Click here to become a pupil of my Brute! It's really cool, I swear.


28 May 2017 07:43
Profile WWW
Veteran

Joined: 21 Mar 2016 09:17
Posts: 206
Yay! *extremely enthusiastic cheering* A million thanks, Melarec! It works, you're a genius!

Could you explain about the global and alias?

_________________
Alea iacta est. Serius regredi est.


28 May 2017 08:15
Profile
Veteran

Joined: 21 Mar 2016 09:17
Posts: 206
(3 days for a calculator. *amuse*) Oh, and 7500 coppers is 4 plat, 4 gold, 1 silver.

_________________
Alea iacta est. Serius regredi est.


28 May 2017 08:17
Profile
Rising Hero
User avatar

Joined: 29 Feb 2016 19:51
Posts: 318
Location: Everywhere
Kwevin wrote:
Yay! *extremely enthusiastic cheering* A million thanks, Melarec! It works, you're a genius!

Could you explain about the global and alias?
Yay! I wouldn't say genius, but.. :P Glad it works.
By Global, I meant the first line where you first define "copp"
As for alias, I meant to tie the code to an alias like "coinCalc"
And what I meant by all this was to change the number in the first line whenever you wanted to calculate the coins and use the alias to execute the code.

_________________
Chillin
[-_- ]
Click here to become a pupil of my Brute! It's really cool, I swear.


29 May 2017 04:42
Profile WWW
Veteran

Joined: 21 Mar 2016 09:17
Posts: 206
Oh, like actually modify the value in the code each time?

Eh, sounds cumbersome, if so. That's what I'm doing now, and I don't want that. After reading something else, I think I have to use an arg.
Could I reference a trigger somehow, with gwc.userdata.triggername? Think I've seen people doing it with aliases.

_________________
Alea iacta est. Serius regredi est.


29 May 2017 04:55
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 29 posts ]  Go to page Previous  1, 2, 3

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.