![]() |
There are a few things you could change with what you have written up so far..
We'll start from the beginning, excluding the onSelect event...we'll get back to that, but first: PHP Code:
Putting this inside of onCreated() { this.tools = {blah...}; } will work, but I'd recommend an alternative method for defining the tools list (possibly something serverside if this is a shop menu and sending it to the client). Continuing on... PHP Code:
Use PHP Code:
In your code, your list control is this: PHP Code:
It should be: PHP Code:
|
@Fowlplay Thanks, I couldn't find a thing to use, that's just the kind of thing I was looking for :D
@Torankusu Thanks for looking through it, it's more of just a random thing I was working on to get more practice with gui's etc, so I didn't think of adding serverside protection or whatever for the array. As for the rest, thanks I'm gonna take a look at my code and see if I can fix these errors :) |
You can find more events for GUI objects here:
http://wiki.graal.net/index.php/Crea...ent/GuiControl |
I am having trouble with params. I am really not sure how to phrase this question I will try the best I can. Ok so I was making a small shop menu, and I wanted to have the npc trigger the shop menu. In the npc trigger to the shop it would contain the price and other params. I want to be able to use these params in the weapon it triggers and for example make the price.txt = the param price. I also am confused on how the script will know what the trigger is and to make it so it only uses the param of that trigger. For example, if you had more than one triggers going to a weapon script and you wanted to make a gui txt say param 3, how would you be able to tell it to only use param 3 of a certain trigger? I pasted my current script also, as I''m pretty sure I did not phrase any of this right D:
Npc - http://pastebin.com/uiBWRAUL Weapon - http://pastebin.com/W87eGjhX |
Never mind on my last post. I was over thinking something simple.
|
For what its worth, params start at 0
Your npc script: params[0] = buymenu1 params[1] = 1000 params[2] = nameyouhad? Also, you can do: onActionClientside (cmd, price, itemname) and reference the parameters passed from serverside that way. Ex: echo(price); |
Quote:
Would anyone be able to explain tokenizing to me/link me to anything on it please? |
Quote:
Example: Player chats: "This is an example" PHP Code:
tokenscount (will yield 4) tokens[0] will reference the first token (the word "this"). Similarly, tokens[2] will reference the word "an". |
Quote:
|
Quote:
PHP Code:
Also, for the delimiters, you would basically be able to put for example a word such as "idigzy" and wherever that word occurs it splits it :o? |
Quote:
random tailor example for tokenize [better ways to do this...example for simplicity sake..]: PHP Code:
Quote:
some common delimiters: are , (commas), spaces . (periods) , and so on... there is a tokenize2 but I didn't want to include it. You can scripthelp it. Is there anything you are trying to do in specific, there might be a better approach? |
@Torankusu Thanks for all the help on that :). I'm not really trying to do anything in particular at the moment, I just thought I'd play around with it since I may use it in the future.
|
PHP Code:
Also PHP Code:
PHP Code:
and PHP Code:
PHP Code:
so: PHP Code:
|
@sssssssssss thanks for the response :)
|
I saw an error in my code. :x sry
PHP Code:
|
Would anyone be able to link me to some guides on databases/some good examples :)?
|
Quote:
http://wiki.graal.net/index.php/Crea...t/Using_SQLite |
Quote:
My advice would probably be to learn SQL/SQLite outside of Graal first. Using it in Graal will then be pretty easy. |
Quote:
|
:x
|
@ cyan3 thanks for the link, but I should have made myself more clear, I'm trying to practice/learn database npc more at the moment, I will be learning or starting SQL whenever I am more advanced
@cbk1994 I'll remember that for when I start thanks I'm really stuck on database/database npc's though. Are there many guides/information on them? Also, how would you go about making for example a simple spar stat database to keep information on player spar wins? Also, could someone possibly explain why/when you would use them more often, as it would probably make more seance to just use clientr to record spar stats for example? |
I can't help much with this, but I can give you an example in relation to the shop stuff you were working on previously.
full script: http://forums.graalonline.com/forums...highlight=shop In a Database NPC, such as: DB_Prices, put the following: PHP Code:
PHP Code:
That is just one example. I do hope someone else can chime in because I would like to learn a bit more when a Database NPC might be more plausible than just a regular level NPC, etc... |
Thanks for the reply, but I'm still having trouble with them. I tried to make a simple npc where when the player touchs it, it will chat the databases flag. In the database I have
PHP Code:
PHP Code:
|
Quote:
Right. What is the name of your database? Your script says its DB_test Also, you need to indicate the item id in the npc you're touching somewhere: ex: this.item = 100; Then reference it like this: this.chat = DB_test.("item_" @ this.item); |
Maybe this is what you're looking for.
DB_test: PHP Code:
PHP Code:
|
Quote:
|
Quote:
I understand you might be trying to go off of my previous examples, but could you give us some code examples ? |
This may be really off, but I tried to make it so when a player touches the npc it adds 1 to the item_playersname in the databse. Can someone explain what is wrong here and how to fix please?
In NPC: PHP Code:
PHP Code:
|
Yeah, seems like you didn't format things properly..
wrong: this.ida = stats_(this.playername); right: this.ida = (@ "stats_" @ this.playername); wrong: DB_test.addstats(this.ida) += 1; right: DB_test.addstats(this.ida); Although the way you set this up was odd, here's how I would of done it. NPC: PHP Code:
PHP Code:
|
Thanks tim and torankusu for the help. I finally get how to set it up :)
|
I started to take a look at sql and I am pretty stuck on some basic things :(. I wanted to try to make a simple login database for practice, but I couldn't get it to work at all. I used the SQL explorer and put in :
PHP Code:
The script in the npc is - http://pastebin.com/2s1HeB2L (The forums were giving me an error so I just pasted the scripts on pastebin instead) |
I think you should stick to the other scripting stuff before jumping over to sql
|
callimuc is correct, it is not a good idea to delve into sql while not being completely familiar with the language syntax
there are at least 4 problems with what you are attempting to do -
if you ever encounter sql within a live environment you should never tamper with it unless you are completely sure about how it works and how to use it |
Thanks for the replies, I guess I'll just stick with learning some other things for now than
|
I am working on making a custom chat system, and I wanted to have a gui to display previous chat from the player and other players. I managed to get most of it to work, but I am stuck on getting it to send to other players gui and have it display others text. Can someone explain what is wrong and possibly if there is a better way to find the players than by if they are in the same level?
trigger: PHP Code:
PHP Code:
http://pastebin.com/ts8SGipV (forum kept giving me a denial message, so I posted it there) entire script if it helps to get an idea of what i'm doing: http://pastebin.com/Fm0CMqGb |
You probably want to do pl.triggerClient so you're triggering on that player, not on whoever the current player happens to be.
|
Quote:
|
| All times are GMT +2. The time now is 06:01 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.