Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Tip Jar Help. (https://forums.graalonline.com/forums/showthread.php?t=86593)

Unkownsoldier 06-28-2009 07:52 PM

Tip Jar Help.
 
Currently, on Unholy Nation, there is a restaraunt called "The Crab Shack", currently it looks great and has a lot of good qualities. However, the tip jar is broken.

I need a script that would allow money to go into the jar when someone says /tip #. This would be collected in a chest, now I would need to access this money for paying someone /pay account #. Only this /pay commands can only be used for someone wearing the tag (Crab Shack Manager).

If anyone is not busy, or is looking for a challenge could you help me out please.

xXziroXx 06-28-2009 07:55 PM

Quote:

Originally Posted by Forum Rules
1. Be clear on your ability level. In other words, do not post asking for scripts, or asking people to fix scripts that are above your ability level. If you are writing a script to aid learning, then try writing a simpler script. If you are looking for a script for a server, then the best solution is probably to hire a scripter.

You could at least try and make it on your own, and then ask us what's wrong with it.

Unkownsoldier 06-28-2009 07:56 PM

I am not a scripter, and currently this is a major part of the restaurant. All of Unholy Nations scripters are currently busy with projects and I need to complete this to implement money back into the economy. I am not saying someone has to do this, just if they have free time it would be a nice gesture.

fowlplay4 06-28-2009 07:58 PM

Well.. Here's one piece of the puzzle!

PHP Code:

if (player.rupees amount) {
  
player.rupees -= amount;
  
this.tipjar += amount;


Keep in mind this.tipjar will reset if the level is updated / server goes down. So you will probably want to use a server. or something..

Unkownsoldier 06-28-2009 08:01 PM

Ya I wish I knew what piece it was tho.

Gambet 06-28-2009 08:04 PM

Quote:

Originally Posted by Unkownsoldier (Post 1502412)
Ya I wish I knew what piece it was tho.


It's in GS2 so you wouldn't be able to use it in the offline editor anyways. You should really just let the server staff do this since it would be better for them to just make some type of donation chest class and all you would have to do is join it with a level NPC.

A system like this would require the use of some type of server. var or a database to store the amounts to prevent the tips from resetting each time the level is reset so you should really leave it to the staff. It's easy to make, it wouldn't take them much time.

Deas_Voice 06-28-2009 08:08 PM

a tips to do offline GS2, GScript2 Syntax Highlighting for Notepad++

SwimChao 06-28-2009 08:08 PM

Actually, I'm going to have Lloyd make one base for all around UN instead.

However, for future reference that script asks if the player actually has the gralats ("rupees") to donate. If they do, it subtracts it from then, and adds it to the tip jar.

cyan3 06-28-2009 08:18 PM

1 Attachment(s)
Quote:

Originally Posted by Deas_Voice (Post 1502416)

The text editor I use has GScript2 syntax highlighting by default.

Crow 06-28-2009 09:08 PM

Quote:

Originally Posted by cyan3 (Post 1502426)
The text editor I use has GScript2 syntax highlighting by default.

Yea, well, Linux. Graal delivers syntax highlighting files when downloading RC.

Robin 06-28-2009 09:58 PM

I have gedit for windows installed. Can I get those syntax highlighting files please?

Crow 06-28-2009 10:27 PM

I have no idea if that's the only stuff required, but navigate to C:\Documents and Settings\USERNAMEHERE\.gnome2\gtksourceview-1.0\language-specs\. graal.lang looks convincing ;D

Robin 06-28-2009 11:08 PM

graal.lang is there, but Graal as a syntax type is not there.

DustyPorViva 06-29-2009 12:42 AM

Bleh, I tend to just browse over syntax hilighting anywas... I'm so impatient.

cyan3 06-29-2009 01:46 AM

In my opinion the internal text editor for the remote control should have syntax highlighting because I usually use levels to test my scripts.

Deas_Voice 06-29-2009 09:45 AM

Quote:

Originally Posted by Crow (Post 1502472)
I have no idea if that's the only stuff required, but navigate to C:\Documents and Settings\USERNAMEHERE\.gnome2\gtksourceview-1.0\language-specs\. graal.lang looks convincing ;D

or C:\Users\USERNAMEHERE\.gnome2\gtksourceview-1.0\language-specs\ for vista :)
can you use it in the notepad++?

Robin 06-29-2009 09:57 AM

I am using Windows 7, and I found it.

The reason it was not working for me was because the new gedit uses gtksourceview-2.0, so I copied graal.lang to "C:\Program Files (x86)\gedit\share\gnome2\gtksourceview-2.0\language-specs\" or so :)

Crow 06-29-2009 11:39 AM

Quote:

Originally Posted by Deas_Voice (Post 1502640)
or C:\Users\USERNAMEHERE\.gnome2\gtksourceview-1.0\language-specs\ for vista :)
can you use it in the notepad++?

Nah, but I already used that as a reference when creating my Notepad++ syntax highlighting. I think I accidently left some things out, should check again and add them ;D But the files Graal provides are for GTK only, which makes sense since RC uses GTK. Notepad++ does not, though.

Pelikano 07-02-2009 03:33 PM

PHP Code:

// Created by Pelikano (Sam) for Unkownsoldier, wtf you spelled your Acc wrong dude o.o
function onCreated() {
  
sethape(1,32,32);
  
setimg("chest.png");
}
function 
onPlayerChats() {
  if (
player.chat.starts("/tip")) {
    
temp.money player.chat.substring(5);
    if (
player.rupees money) {
      
serverr.crabshack += money;
      
player.rupees -= money;
      
player.chat "Donated" SPC money;
    }
    else {
      
player.chat "Not enough Rupees!";
    }
  }
  if (
player.chat.starts("/pay") && player.guild == "Crab Shack Manager") {
    
temp.player.chat.tokenize(" ");
    if (
FindPlayerByCommunityName(t[1]) != -1) {
      if (
serverr.crabshack >= t[2]) {
        
FindPlayerByCommunityName(t[1]).rupees += t[2];
        
serverr.crabshack -= t[2];
        
player.chat "Paid" SPC t[1SPC t[2SPC "Gralats!";
      }
      else {
        
player.chat "Not enough Money in the safe!";
      }
    }
    else {
      
player.chat "Player was not found!";
    }
  }


Did something real quick so you have something rofl.
Probably shouldn't be used on UN tho, since I am using serverr.vars, ;)

Chompy 07-02-2009 03:39 PM

Quote:

Originally Posted by Pelikano (Post 1503542)
PHP Code:

... 

Did something real quick so you have something rofl.
Probably shouldn't be used on UN tho, since I am using serverr.vars, ;)

You're also mixing server. and serverr. :cool:

:p

MysticX2X 07-02-2009 06:47 PM

I think he just made a typo.

Chompy 07-02-2009 07:43 PM

Quote:

Originally Posted by MysticX2X (Post 1503580)
I think he just made a typo.

I guess so. I just wanted to point it out ^^

Pelikano 07-02-2009 08:47 PM

that's a major mistake, sry, fixed rofl


All times are GMT +2. The time now is 09:21 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.